Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upScaleControl uses inconsistent earth radius #8777
Comments
This comment has been minimized.
This comment has been minimized.
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. |
This comment has been minimized.
This comment has been minimized.
The figure in |
This comment has been minimized.
This comment has been minimized.
@andrewharvey given how the value is used in |
This comment has been minimized.
This comment has been minimized.
@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. |
This comment has been minimized.
This comment has been minimized.
@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. |
This comment has been minimized.
This comment has been minimized.
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.. |
This comment has been minimized.
This comment has been minimized.
@andrewharvey yes, exactly. Standard Mercator formulas, including the scale factor one, assume spherical earth and so usually use the mean radius value as approximation. |
exe-dealer commentedSep 19, 2019
•
edited
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