1

I'm trying to convert an Esri JSON file to a GeoJSON format using ogr2ogr. For some reason, in the objects returned, the geometry field is constantly null.

Here's the script I'm running:

ogr2ogr -f GeoJSON output.geojson input.json

Here's the input file: https://pastebin.com/RSx4L1vT

Here's the output file: https://pastebin.com/9tHnm2ZH

Here's the original source of the data which I have cleaned up: https://bexleycouncil.maps.arcgis.com/sharing/rest/content/items/95a6e51df1734a859a502109a188790a/data?f=json

I'm fairly new to OGR/GDAL, and know it's something to do with the rings format, but I can't figure it out.

2
  • 1
    what if you use: ogr2ogr -f GeoJSON output.geojson ESRIJSON:input.json
    – nmtoken
    Commented Jan 19, 2022 at 17:49
  • 1
    This JSON looks quite different than the ESRIJSON files which are used in GDAL driver tests github.com/OSGeo/gdal/tree/master/autotest/ogr/data/esrijson. Looks like this data is meant to render a web page. Perhaps it is JSON from ESRI but not pure ESRIJSON that GDAL understands.
    – user30184
    Commented Jan 23, 2022 at 7:09

1 Answer 1

1

Assuming you can use Python 3, there are 2 ways to approach this issue:

  1. Write a Python code (the longer way but you have better control to use precision, geometry type, and compliance checker using geojson_rewind.

  2. Use the available python library: arcgis2geojson from here

Output: Here is a sample output using the second approach:

Additional comments:

  • I did not change your original SRS to latitude-longitude etc.for quick visualization.
  • I am unsure if OGR has ESRIJSON driver to deal with your input data and it was easier to use the Python library.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.