Loading JSON into a GeoDataFrame

后端 未结 4 1878
旧时难觅i
旧时难觅i 2021-02-07 17:48

I\'m having difficulty loading the following JSON containing GIS data (https://data.cityofnewyork.us/resource/5rqd-h5ci.json) into a GeoDataFrame.

The following code fai

4条回答
  •  自闭症患者
    2021-02-07 18:45

    Combining the above answers, this worked for me.

    import pandas as pd
    import geopandas as gpd
    from shapely.geometry import shape
    
    nta = pd.read_json( r'https://data.cityofnewyork.us/resource/93vf-i5bz.json' )
    nta['the_geom'] = nta['the_geom'].apply(shape)
    nta_geo = gpd.GeoDataFrame(nta).set_geometry('geometry')
    

提交回复
热议问题