You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a scattermap (or densitymap) view crosses the ±180° antimeridian the box-select and lasso-select tools do not select points that are visibly inside the drawn region. The selection contains only points from one side of the antimeridian, depending on where the map is centered.
Screenshots/Video
Screencast.From.2026-07-14.16-39-57.mp4
Steps to reproduce
Create a scattermap trace with points that straddle ±180°, e.g.:
Pan so that all points are visible around the antimeridian
Draw a selection box that visually encloses all six points
Observe that the plotly_selected event either fires with an empty selection or with only the subset of points on one side of ±180°
Notes
Root cause suspicion: src/plots/map/map.js:625 (updateFx) builds the selection rect from invert(pxpy) which calls map.unproject, returning [lng, lat] in [-180, 180]. When the two corners of the drag straddle ±180°, the resulting rect has xmin > xmax (e.g., [[179, ...], [-179, ...]]). Downstream selection code assumes xmin < xmax, so the rect either matches nothing or matches the "wrong" 340° arc. The per-point normalization in src/traces/scattermap/select.js:27 (Lib.modHalf(lonlat[0], 360)) doesn't help because the rect coordinates themselves haven't been unwrapped.
Fix likely lives in src/plots/map/map.jsupdateFx / fillRangeItems — unwrap the rect's xmax (add 360°) when xmax < xmin, so downstream xmin < lon < xmax (with lon similarly unwrapped when needed) matches all enclosed points
Also verify the lasso path (poly.map(invert)), which has the same underlying problem: consecutive polygon vertices can jump ±360° across the antimeridian
Description
When a
scattermap(ordensitymap) view crosses the ±180° antimeridian the box-select and lasso-select tools do not select points that are visibly inside the drawn region. The selection contains only points from one side of the antimeridian, depending on where the map is centered.Screenshots/Video
Screencast.From.2026-07-14.16-39-57.mp4
Steps to reproduce
scattermaptrace with points that straddle ±180°, e.g.:{ "data": [{ "type": "scattermap", "lat": [-36.85, -18.14, -16.5, -13.3, -13.83, -21.14], "lon": [174.76, 178.44, 179.9, -176.2, -171.77, -175.2], "mode": "markers", "marker": { "size": 10 } }], "layout": { "dragmode": "select", "width": 900, "height": 600 } }plotly_selectedevent either fires with an empty selection or with only the subset of points on one side of ±180°Notes
src/plots/map/map.js:625(updateFx) builds the selection rect frominvert(pxpy)which callsmap.unproject, returning[lng, lat]in[-180, 180]. When the two corners of the drag straddle ±180°, the resulting rect hasxmin > xmax(e.g.,[[179, ...], [-179, ...]]). Downstream selection code assumesxmin < xmax, so the rect either matches nothing or matches the "wrong" 340° arc. The per-point normalization insrc/traces/scattermap/select.js:27(Lib.modHalf(lonlat[0], 360)) doesn't help because the rect coordinates themselves haven't been unwrapped.src/plots/map/map.jsupdateFx/fillRangeItems— unwrap the rect'sxmax(add 360°) whenxmax < xmin, so downstreamxmin < lon < xmax(with lon similarly unwrapped when needed) matches all enclosed pointspoly.map(invert)), which has the same underlying problem: consecutive polygon vertices can jump ±360° across the antimeridian