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

The legacy centerAndZoom sets the wrong center #4061

Closed
milespetrov opened this issue Oct 19, 2022 · 3 comments
Closed

The legacy centerAndZoom sets the wrong center #4061

milespetrov opened this issue Oct 19, 2022 · 3 comments
Assignees

Comments

@milespetrov
Copy link
Member

You can see the map pan/shift a bit when you run RV.getMap("fgpmap").centerAndZoom(RAMP.mapInstances[0].center.x, RAMP.mapInstances[0].center.y, 4326, RAMP.mapInstances[0].zoom); in the dev console.

Sounds like a precision issue somewhere in the code. The RAMP.mapInstances[0].center object seems precise enough {x: -57.84282243778783, y: 54.43906496234642}

@james-rae
Copy link
Member

Interesting. The "jump" is far more severe if you're at a Canada-level scale then a city-level scale. Hmmmm

@james-rae
Copy link
Member

Looks like it's the .center that is off.

@james-rae
Copy link
Member

Need to dig more, but I believe this is a problem with how RAMP2 dealt with co-ordinates via the API.

Every API output is forced into lat/long projection. The .center call is deriving the center of the map extent. BUT it is using a projected extent, not the raw extent. Regular geometry can be re-projected seamlessly, but extents are special in that they need to have right-angle corners in their projection. Going from Lambert (cone shaped) to Lat/Long (sphere) involves some distortion & warping.

A possible fix is to re-route the .center method to interrogate the raw extent, get the center point in the map's projection, then re-project the point, and return that.

@james-rae james-rae self-assigned this Oct 20, 2022
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

2 participants