0

I've downloaded some geodata but I'm unable to import it into GeoPandas.

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]]]}},
]}

I've tried the following:

import geopandas as gpd

df = gpd.read_file(filename)
df.head()

but it doesn't return any rows...

Is this standard GeoJSON or a different format? What does "rings" mean here? My assumption was that there would be additional keys in the JSON schema for both latitude and longitude, but instead I see a list/array.

  • 3
    That's not geojson. It's an ArcGIS JSON format. GDAL/OGR->fiona->geopandas should be able to read it if it has a ".json" file extension, not, ".geojson". Alternatively you can convert it to geojson - there's python libraries and online converters (i.e arcgisjson.togeojson.com) – user2856 May 15 at 23:12
  • Thanks for the note, I pasted the above snipped into that online converter and got the message "invalid input". Is there something i'm missing, is the data in the correct form? Do I have to change anything? Thanks! – vgoklani May 16 at 0:19
  • 3
    Try your entire json. And replace single quotes with double quotes, as per the json standard. – user2856 May 16 at 0:23
  • 1
    None to null rather than "", right? – bugmenot123 May 16 at 7:43
  • What are these values in the array: [[[-9235687, 4854329], [-9235918, 4851467], [-9239010, 4854564], [-9235687, 4854329]]] they don't look like latitude longitude, etc? – vgoklani 7 hours ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.