Adapted the script by Yonhah: https://github.com/yonghah/esri2sf/blob/master/R/esri2sf.R
✓ Published0🌍 Public
FFrieseWoudloper
Last edited Aug 7, 2018
Created on Aug 7, 2018
This example demonstrates how to fetch GIS feature data from an ArcGIS REST server and convert it into simple features for spatial analysis in R. It shows a workflow that queries a specified layer, retrieves object IDs, and then pulls the corresponding attributes and geometries as GeoJSON. The code relies on the `httr` package for HTTP requests, `jsonlite` for parsing JSON responses, and `sf` for handling spatial data. It also includes a helper function to generate authentication tokens when the server requires login. The implementation uses the ArcGIS REST API's `query` endpoint to request data in batches of 500 IDs, ensuring efficient retrieval of large datasets.
AI-generated description