Gary Sieling

Exporting GeoJson data from ESRI Arcgis

Many government agencies have published datasets of internal information for use by the public. For example, there has been significant interest in datasets by local law enforcement. Mapping data is often rendered through the public ESRI ArcGIS website, such as this example which shows Harrisburg Police Districts | GIS Datahub (arcgis.com):

It seems that the owner of the data can elect whether to allow the files to be downloadable or not, independent of the license the owner applies to the source. In many cases, files are publicly viewable, but not downloadable in an obvious fashion, although if you do a “view source” on the page, you can copy out the SVGs and render on it’s own, lacking the lat/long data:

For these files, arcgis has a parallel service, which lets you “query” the data. In the general case, these files could be quite large, so I think the service is not generally intended to be the way to download the source. However, for a lot of municipal data, it is really quite small, and the query API is good.

Query (Feature Service)—ArcGIS REST APIs | ArcGIS Developers

For instance, in the Harrisburg police data set, this is the API:

Query: Harrisburg Police Districts (ID: 0) (arcgis.com)

If you change “where” to “1=1”, it pulls all data, and if you change format to “geojson”, you then get a usable format:

services5.arcgis.com/9n3LUAMi3B692MBL/arcgis/rest/services/Harrisburg_Police_Districts/FeatureServer/0/query?where=1%3D1&objectIds=&time=&geometry=&geometryType=esriGeometryPolygon&inSR=&spatialRel=esriSpatialRelContains&resultType=standard&distance=0.0&units=esriSRUnit_Meter&relationParam=&returnGeodetic=false&outFields=&returnGeometry=true&returnCentroid=false&returnEnvelope=false&featureEncoding=esriDefault&multipatchOption=xyFootprint&maxAllowableOffset=&geometryPrecision=&outSR=&defaultSR=&datumTransformation=&applyVCSProjection=false&returnIdsOnly=false&returnUniqueIdsOnly=false&returnCountOnly=false&returnExtentOnly=false&returnQueryGeometry=false&returnDistinctValues=false&cacheHint=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&having=&resultOffset=&resultRecordCount=&returnZ=true&returnM=true&returnExceededLimitFeatures=true&quantizationParameters=&sqlFormat=none&f=pgeojson&token=

Exit mobile version