Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translating Features of large distances heavily distorts & flips them (at ~+-90°long) #898

Open
3 tasks
mmodrow opened this issue Apr 4, 2024 · 5 comments

Comments

@mmodrow
Copy link

mmodrow commented Apr 4, 2024

Describe the bug

When I create any feature (e.g. go to the geojson-editor demo and load blank, afterwards draw a polygon) and then translate it more than 90° along long in any direction, the feature gets totally destroyed along the closest pole and when translated further along the long axis, it returns to normal, but upside down.

Actual Result

Widely distorted translated feature, that has no resemblance of the original feature, even though the default projection should not distort on long-translation at moderate lat coords. E.g. outlining the USA and translating them to Europe gives random shapes at Arctica.

Expected Result

Translating the outline of the USA to Europe should put the outline of the USA undistored ontop of the EU

Reproduce Steps

  • Open a Nebula Map that supports feature translation and global zoom (e.g. the geojson-editor demo)
  • Create any feature that is reasonably sized for world scope view (e.g. outline a big country)
    • It should not be too far off the Equator.
  • Select the feature and translate it ~90° along the long axis and then another 90° in the same direction

Screenshots

nebula_feature_translate_distortion

To Do List

  • Add label and assign to milestone
  • Coding
  • Test
@ibgreen
Copy link
Collaborator

ibgreen commented Apr 4, 2024

A native attempt to break this down into smaller more actionable issues:

  • The more straightforward observation seems to be that Web Mercator project breaks down at big latitudes (I see a collapse over Greenland). We could perhaps implement a check to cap the values and avoid infinities to avoid "degenerate" geometries.
  • I wonder if the vertical flip is related to the above.
  • Perhaps you could offer a choice of to map vertices during translation in a word level view: lat-lon space, x-y space etc?

@igorDykhta
Copy link
Collaborator

@mmodrow Have you tried screenSpace prop?

@mmodrow
Copy link
Author

mmodrow commented Apr 5, 2024

Could you please elaborate, @igorDykhta ? I find no such prop anywhere in the code or documentation of nebula, deck or mapbox... Where would I set this?

@igorDykhta
Copy link
Collaborator

@mmodrow

Translate mode

  • screenSpace option can be provided in the modeConfig of Translate mode so the features will be translated without distortion in screen space.

Not exactly sure how good it works near the poles.

@mmodrow
Copy link
Author

mmodrow commented Apr 5, 2024

Apparently I already had it on screenSpace: true. unsetting it made no difference...

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

No branches or pull requests

3 participants