@@ -109,6 +109,7 @@ def close_map(
109109 background = None ,
110110 background_color : Any = "#3b6fb0" ,
111111 background_opacity : float = 0.3 ,
112+ mark = None ,
112113 buffer : float = 0.15 ,
113114):
114115 """Draw a :class:`geopandas.GeoDataFrame` from a client method as an
@@ -130,7 +131,8 @@ def close_map(
130131 (e.g. a city boundary from ``place_boundary``). ``background`` is one polygon
131132 GeoDataFrame, or a list of them, drawn as semi-transparent fills underneath
132133 (e.g. commute isochrones or a walkshed); ``background_color`` recycles across
133- them. Returns a plotly ``Figure``.
134+ them. ``mark`` draws an "✕" on top at a ``(lon, lat)`` pair or a point
135+ GeoDataFrame (e.g. a starting point). Returns a plotly ``Figure``.
134136 """
135137 try :
136138 import plotly .graph_objects as go
@@ -237,6 +239,22 @@ def close_map(
237239 traces .append (go .Choroplethmapbox (
238240 z = z , colorscale = colorscale , showscale = False , ** common ))
239241
242+ # A point marked with an "✕", drawn last so it sits on top of everything.
243+ if mark is not None :
244+ import geopandas as gpd
245+
246+ if isinstance (mark , (gpd .GeoDataFrame , gpd .GeoSeries )):
247+ geom = (mark .geometry if isinstance (mark , gpd .GeoDataFrame ) else mark )
248+ geom = geom .to_crs (4326 )
249+ mlon , mlat = list (geom .x ), list (geom .y )
250+ else :
251+ mlon , mlat = [mark [0 ]], [mark [1 ]]
252+ bounds .append ([min (mlon ), min (mlat ), max (mlon ), max (mlat )])
253+ traces .append (go .Scattermapbox (
254+ lon = mlon , lat = mlat , mode = "text" , text = ["✕" ] * len (mlon ),
255+ textfont = {"size" : 22 , "color" : "#111111" },
256+ hoverinfo = "skip" , showlegend = False ))
257+
240258 center , zoom = _center_zoom (bounds , buffer )
241259 fig = go .Figure (traces )
242260 fig .update_layout (
0 commit comments