mapbox / mapboxgl-jupyter

Use Mapbox GL JS to visualize data in a Python Jupyter notebook
MIT License
668 stars 137 forks source link

How to load ArcGIS JSON data into mapbox? #153

Closed vgoklani closed 5 years ago

vgoklani commented 5 years ago

I've downloaded some ArcGIS JSON but I'm unable to import it into Mapbox.

This is a sample of the geodata (I've trimmed the JSON object):

{'displayFieldName': 'NAME',
 'fieldAliases': {},
 'geometryType': 'esriGeometryPolygon',
 'spatialReference': {'wkid': 102100, 'latestWkid': 3857},
 'fields': [],
 'features': [{'attributes': {'OBJECTID': 2050,
    'PRECINCTID': '01029B',
    'NAME': 'COLUMBUS 29-B',
    'COUNTY': None,
    'ESS_PRECINCT_NO': None,
    'ESS_PRECINCT': None,
    'CITY_OR_VILLAGE': None,
    'SCHOOL_DISTRICT': None,
    'TOWNSHIP': None,
    'HOUSE_DISTRICT': None,
    'SENATE_DISTRICT': None,
    'CONGRESS_DISTRICT': None,
    'POLICE_DISTRICT': None,
    'ROAD_DISTRICT': None,
    'FIRE_DISTRICT': None,
    'PARK_DISTRICT': None,
    'COURT_APPEALS_NAME': None,
    'BOARD_OF_ED_NAME': None,
    'LIBRARY': None,
    'EDUCATIONAL_SERVICE_CENTERS': None,
    'CAREER_CENTERS': None,
    'WINNINGPARTY': None,
    'TOTALBALLOTS': None,
    'SHAPE_Length': 26636.15475759097,
    'SHAPE_Area': 30443700.474467456,
    'POLLINGID': None,
    'POLLINGLOCATION': None,
    'LID': 'N/A',
    'Symbol': 'A'},
   'geometry': {'rings': [[[-9235687, 4854329],
      [-9235918, 4851467],
      [-9239010, 4854564],
      [-9235687, 4854329]]]}},
]}

How do I render this data in Mapbox? I've seen the instructions for loading geojson, but not ArcGIS JSON. Thanks!

akacarlyann commented 5 years ago

Hmm, I've only worked with GeoJSON similar to the examples in the spec at https://geojson.org/. Looks like ESRI might have a particular structure we'll need a converter for. You'll also have to account for projection, since it looks like your data is in map coordinates rather than latitude/longitude.

vgoklani commented 5 years ago

I converted this data into geojson, but was unable to render it in Mapbox. I posted this under a separate question here - please let me know if it makes sense.

https://github.com/mapbox/mapboxgl-jupyter/issues/154

ryanbaumann commented 5 years ago

@vgoklani to test if you have valid geoJSON, try exporting your data to file and loading it in a tool like www.geojson.io