folium.GeoJson
displays all the counties of New York State:
import geopandas as gpd
gdf = gpd.read_file("Counties_Shoreline.shp")
m = folium.Map(location=[43.062776, -75.420884], tiles="cartodbpositron", zoom_start=7)
folium.GeoJson(data=gdf["geometry"]).add_to(m)
m
However, it fails to display a single county, outputting a map without borders when only the first row data, gdf["geometry"][0]
, is used:
m = folium.Map(location=[43.062776, -75.420884], tiles='cartodbpositron', zoom_start=7)
folium.GeoJson(data=gdf["geometry"][0]).add_to(m)
m
This despite the fact that the polygon appears fine, rendering inside Jupyter Notebook.
Data here: http://gis.ny.gov/gisdata/fileserver/?DSID=927&file=NYS_Civil_Boundaries.shp.zip Shapefile: Counties_Shoreline.shp