[OSM-dev] Earth radius

Greg Troxel gdt at ir.bbn.com
Sun Jun 19 01:09:15 UTC 2016

"Stadin, Benjamin" <Benjamin.Stadin at heidelberg-mobil.com> writes:

> I indeed need to express distances in meters. This is a sinusoidal
> grid with Varying cell resolutions, matching the length of web
> mercator tiles at the equator.  I could use any value greater or equal
> to the defined sphere radius, but not smaller.  To be consistent, it
> should be equal.

Things to keep in mind:

  WGS84 is an ellipsoid, not a sphere.  There is a radius and
  flattening, or alternatively different equatorial and polar radii.

  "Web Mercator" or "Spherical Mercator" is not actually Mercator, and
  is not conformal.   It projects by assuming a sphere, which isn't
  true.  So trying to use one radius to get distances on the surface
  from projected coordinates is not going to work well.

So if you want the right answers, use proj.4, use real WGS84
coordinates, and use the geodesic functions.

If you need fast math within a local region, I would suggest computing a
few correct values (a point, offset in easting, offest in northing) by
going from projected back to geodetic and then calculate geodesics,
finding out the ratio of distance to projected coords, and then building
a local approximation function.  But if you aren't having CPU pain from
doing it right, I would just use proj.4.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 180 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20160618/138b5fbf/attachment.sig>

More information about the dev mailing list