maptastik
11/1/2017 - 5:17 PM

Create a geopandas GeoDataFrame from remote GeoJSON

Pull GeoJSON from the toobz and create a GeoDataFrame

import requests, json, geopandas as gpd

def remoteGeoJSONToGDF(url, display = False):
    """Import remote GeoJSON to a GeoDataFrame
    Keyword arguments:
    url -- URL to GeoJSON resource on web
    display -- Displays geometries upon loading (default: False)
    """
    r = requests.get(url)
    data = r.json()
    gdf = gpd.GeoDataFrame.from_features(data['features'])
    if display:
        gdf.plot()
    return gdf