-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
ScaleControl uses inconsistent earth radius #8777
Comments
Hmm, that's a good question. I think the radius in From Wikipedia:
@andrewharvey I'm guessing that because you're calculating the circumference at the equator, you wanted a more exact radius than is needed for the spherical approximation in the scale, which I think is also fine. If we want to coordinate values like this, maybe it would be a good idea to pull them into a file that could be included elsewhere so we can define them once and not have inconsistencies in the code. |
The figure in |
@andrewharvey given how the value is used in |
@mourner Sorry I don't understand. What does "radius value" mean here? At the equator (ie. along the semi-major axis) the inverse flattening won't matter or affect it right? And then we use the scale factor to account for larger latitudes being larger on the map. |
@andrewharvey at the equator, it won't, but at other latitudes, it will — the Earth radius (the circumference is calculated from) will be smaller. You can either account for that with complicated formulas, or take a mean value across latitude range for simplicity — super-precision isn't important for the scale control anyway. |
Ok, maybe I misunderstood this then, I thought the scale factor formula I used accounted for this. But maybe that's just for the Mercator projection on a spherical datum instead of on the ellipsoidal datum which EPSG:3857 uses.. |
@andrewharvey yes, exactly. Standard Mercator formulas, including the scale factor one, assume spherical earth and so usually use the mean radius value as approximation. |
Proposed correction: #9202 |
mapbox-gl-js version: 1.3.1
browser: *
Why scale control uses different earth radius than mercator projection code? Is this ok?
mapbox-gl-js/src/ui/control/scale_control.js
Line 130 in 2020f3f
mapbox-gl-js/src/geo/mercator_coordinate.js
Line 9 in 2020f3f
The text was updated successfully, but these errors were encountered: