Skip to content

Fix line2points to always return strict [longitude, latitude] point arrays - #64

Merged
ohanssen merged 2 commits into
masterfrom
copilot/fix-line2points-function
Jul 15, 2026
Merged

Fix line2points to always return strict [longitude, latitude] point arrays#64
ohanssen merged 2 commits into
masterfrom
copilot/fix-line2points-function

Conversation

Copilot AI commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

line2points was documented to return [[longitude, latitude], ...] but the zero-distance edge case returned [from] directly — passing through the raw input coordinate which may carry extra dimensions (e.g. a 3D [lon, lat, altitude] coordinate).

Change

  • totalDist === 0 edge case (mapbrowser/mapbrowser.js): replaced return [from] with return [[from[0], from[1]]] to explicitly construct a 2-element [longitude, latitude] pair, consistent with the output of every other code path (the main loop already produces correct 2-element arrays via ol.sphere.offset).

@ohanssen
ohanssen marked this pull request as ready for review July 15, 2026 10:37
Copilot AI review requested due to automatic review settings July 15, 2026 10:37
@ohanssen
ohanssen merged commit b2b6644 into master Jul 15, 2026
1 check passed
@ohanssen
ohanssen deleted the copilot/fix-line2points-function branch July 15, 2026 10:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants