0

I am computing the Mercator points according to the top answer at Convert latitude/longitude point to a pixels (x,y) on Mercator projection.

Now that I have two Mercator points on a spherical projection, how do I compute the distance between them?

For some background, what I am attempting to do is implement the answer at How to calculate the optimal zoom-level to display two or more points on a map and am stuck at step #2 where I need to compute the distance.

  • You are going in the wrong direction. The best way to calculate distance between arbitrary points is via latitude and longitude. Mercator is useless for distance measurement. – Vince May 15 at 21:19
  • Then, what is the right direction given my end goal? Considering I am working on a sphere, are Mercator coordinates really useless for the purpose I need them for? – ericg May 15 at 23:12
  • 3
    Mercator is useless for distance - the poles are infinitely distant from the Equator. Greenland is not the same area as South America (it's 1/8 the size). Every measurement that leaves the Equator is corrupted by the sine of the latitude. The are sufficient libraries to calculate geodetic distance on the spheroid which are fast enough for most purposes. – Vince May 15 at 23:21
  • I do not believe any of those issues matter for my purpose or situation. So, if you know the answer to the question asked, I would appreciate learning what it is. – ericg May 16 at 2:03
  • You're better off using the helper functions than writing your own, but for meaningless distance calculation, Pythagoras is still the way to go. – Vince May 16 at 2:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.