@@ -124,14 +124,14 @@ def close_map(
124124 ``fill`` is the name of a numeric column to shade features by, on a
125125 continuous ColorBrewer scale with a legend (use it OR ``highlight``);
126126 ``palette`` (default ``"YlGnBu"``) and ``reverse`` control that scale.
127- ``reverse=False`` puts the blue end at the high values; pass ``reverse=True``
128- when high values mean *less* access, e.g. travel time .
127+ ``reverse=False`` (default) puts blue at the low values, ``reverse=True`` at
128+ the high values — choose so blue marks the most-accessible end .
129129
130130 ``boundary`` is a polygon GeoDataFrame drawn as a grey outline underneath
131131 (e.g. a city boundary from ``place_boundary``). ``background`` is one polygon
132132 GeoDataFrame, or a list of them, drawn as semi-transparent fills underneath
133133 (e.g. commute isochrones or a walkshed); ``background_color`` recycles across
134- them. ``mark`` draws an "✕" on top at a ``(lon, lat)`` pair or a point
134+ them. ``mark`` draws an X on top at a ``(lon, lat)`` pair or a point
135135 GeoDataFrame (e.g. a starting point). Returns a plotly ``Figure``.
136136 """
137137 try :
@@ -239,7 +239,8 @@ def close_map(
239239 traces .append (go .Choroplethmapbox (
240240 z = z , colorscale = colorscale , showscale = False , ** common ))
241241
242- # A point marked with an "✕", drawn last so it sits on top of everything.
242+ # A point marked with an X (two crossing line segments — mapbox text glyphs
243+ # do not render on the raster basemap), drawn last so it sits on top.
243244 if mark is not None :
244245 import geopandas as gpd
245246
@@ -250,9 +251,17 @@ def close_map(
250251 else :
251252 mlon , mlat = [mark [0 ]], [mark [1 ]]
252253 bounds .append ([min (mlon ), min (mlat ), max (mlon ), max (mlat )])
254+ xs = [c for b in bounds for c in (b [0 ], b [2 ])]
255+ ys = [c for b in bounds for c in (b [1 ], b [3 ])]
256+ hs = max (max (xs ) - min (xs ), max (ys ) - min (ys )) * 0.02
257+ lons , lats = [], []
258+ for lo , la in zip (mlon , mlat ):
259+ dla = hs * math .cos (math .radians (la )) # square against the Mercator stretch
260+ lons += [lo - hs , lo + hs , None , lo - hs , lo + hs , None ]
261+ lats += [la - dla , la + dla , None , la + dla , la - dla , None ]
253262 traces .append (go .Scattermapbox (
254- lon = mlon , lat = mlat , mode = "text" , text = [ "✕" ] * len ( mlon ) ,
255- textfont = {"size " : 22 , "color " : "#111111" },
263+ lon = lons , lat = lats , mode = "lines" ,
264+ line = {"color " : "#111111" , "width " : 3 },
256265 hoverinfo = "skip" , showlegend = False ))
257266
258267 center , zoom = _center_zoom (bounds , buffer )
0 commit comments