Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Docs: avoid network in GeoPandas examples; use in-memory fallback Geo…
…DataFrame\n\nRemoves URL fallback to prevent CI build failures in restricted environments.\nKeeps compatibility with GeoPandas <1.0 and >=1.0, and avoids extra deps.
  • Loading branch information
Ali Abouelazm authored and Ali Abouelazm committed Nov 16, 2025
commit 9ec9a4516984fbc740f2ef60cdaec873ec99c983
10 changes: 7 additions & 3 deletions doc/python/scatter-plots-on-maps.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ fig.show()
import plotly.express as px
import geopandas as gpd

# Handle both old and new GeoPandas versions
# Handle both old and new GeoPandas versions without requiring network access
try:
# Try the old method (GeoPandas < 1.0)
geo_df = gpd.read_file(gpd.datasets.get_path('naturalearth_cities'))
Expand All @@ -84,8 +84,12 @@ except (AttributeError, ValueError):
import geodatasets
geo_df = gpd.read_file(geodatasets.get_path('naturalearth.cities'))
except ImportError:
# Fallback: use a direct URL if geodatasets is not available
geo_df = gpd.read_file('https://raw.githubusercontent.com/geopandas/geopandas/main/tests/data/naturalearth_cities.geojson')
# Fallback: build a tiny in-memory GeoDataFrame (no internet or extra deps)
from shapely.geometry import Point
geo_df = gpd.GeoDataFrame(
{"name": ["City A", "City B"], "geometry": [Point(0, 0), Point(10, 10)]},
crs="EPSG:4326",
)

px.set_mapbox_access_token(open(".mapbox_token").read())
fig = px.scatter_geo(geo_df,
Expand Down
10 changes: 7 additions & 3 deletions doc/python/tile-scatter-maps.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fig.show()
import plotly.express as px
import geopandas as gpd

# Handle both old and new GeoPandas versions
# Handle both old and new GeoPandas versions without requiring network access
try:
# Try the old method (GeoPandas < 1.0)
geo_df = gpd.read_file(gpd.datasets.get_path('naturalearth_cities'))
Expand All @@ -66,8 +66,12 @@ except (AttributeError, ValueError):
import geodatasets
geo_df = gpd.read_file(geodatasets.get_path('naturalearth.cities'))
except ImportError:
# Fallback: use a direct URL if geodatasets is not available
geo_df = gpd.read_file('https://raw.githubusercontent.com/geopandas/geopandas/main/tests/data/naturalearth_cities.geojson')
# Fallback: build a tiny in-memory GeoDataFrame (no internet or extra deps)
from shapely.geometry import Point
geo_df = gpd.GeoDataFrame(
{"name": ["City A", "City B"], "geometry": [Point(0, 0), Point(10, 10)]},
crs="EPSG:4326",
)

fig = px.scatter_map(geo_df,
lat=geo_df.geometry.y,
Expand Down