Fix GeoPandas dataset compatibility for naturalearth_cities
Closes #5289
Update documentation examples to support both GeoPandas < 1.0 and >= 1.0.
Context: GeoPandas 1.0 removed the datasets accessor used in gpd.datasets.get_path("naturalearth_cities").
Changes:
- Try old method first for backward compatibility
- Fallback to
geodatasetspackage for GeoPandas >= 1.0 - Final fallback to a public GeoJSON URL if
geodatasetsis not available
Files updated:
- doc/python/scatter-plots-on-maps.md
- doc/python/tile-scatter-maps.md
Docs-only change.
Thanks for the PR! We'll try to review this as we have time. This seems to be related to #4782.
@LiamConnors Any reason not to simply require geopandas>=1.0? I'm not sure if we need to provide examples for both old and new geopandas.
@LiamConnors Any reason not to simply require
geopandas>=1.0? I'm not sure if we need to provide examples for both old and new geopandas.
I agree. It doesn't need to be compatible with old geopandas. Instead of having an example that creates theGeoDataFrame in the code, it would also be fine to just use one of the available datasets in geodatasets even if that won't work with earlier versions of geopandas.