[Proj] Re: Distance measured in Mercator projection

Ed McNierney ed at mcnierney.com
Thu Jul 10 09:42:55 EDT 2008

Shannon -

Thanks for the info and update.  I am often found on a soapbox bemoaning the way that Google is persuading many folks to build bad maps, and in some cases to take maps working well and make them work less well, but I'll stay off that soapbox today ;-)

If your application is primarily interested in circles and distances on the order of 5 miles or so (or even 50 miles) then the errors in your Mercator distance measurement are unlikely to be of much importance to you.  At the latitude of Chicago, the scale factor at a point 50 miles further north or south (that is, about a degree of latitude north or south of 42 degrees North) is less than 2% different than the scale factor at the center point.  It sounds like you're not trying to do high-precision measurement so that's probably just fine but you should be aware that going to greater distances (or moving much further North) will increase the error.

    - Ed

Ed McNierney
205 Indian Hill Road
Groton, MA  01450
ed at mcnierney.com
+1 (978) 761-0049

On 7/10/08 7:02 AM, "Shannon Scott" <sscott at locationinc.com> wrote:

Thank you all for your comments.
1m / cos (phi) was the formula I was looking for.

We have an application that maps data based on a search radius ( ie 5
miles around Chicago ).
The maps show the search radius. We had been using UTM for the maps, so
I was able to plot the search radius with this piece of code:
// convert miles to meters
bufdist = (miles * 1609.344);

// create circle
for (double i=0;i<360;i+=5) {
deltax = (Math.cos(i) * bufdist);
deltay = (Math.sin(i) * bufdist);
pntx = (centerPntx + deltax);
pnty = (centerPnty + deltay);
// plot point

The maps have been converted to work as a google map overlay, so we need
to use the Mercator projection.
I have modified the way the search radius is calculated:
// convert miles to meters
bufdist = (miles * (Math.abs(1609.344 * (1/Math.cos(latrad)))));

and everything looks good.
Thanks again.

Ed McNierney wrote:
> Shannon -
> First, let me apologize for trying to respond (twice) when I was too
> rushed to do so properly.
> Since you say you're not very familiar with map projections, it might
> be helpful for you to describe a little bit more about what you're
> trying to do. Daan's and Chris's comments are both correct but could
> be confusing to a novice; the scale factor at a single point is the
> same in all directions for a Mercator projection, but strictly
> speaking only at that point. If you have another point in a different
> place, the scale factor at that point will be different from the first
> unless they're at exactly the same latitude. So if you're measuring
> the distance between two points at a non-trivial distance apart, a
> 500-mile line will, for example, change length on a Mercator map
> depending on its angle with the Equator. What I was trying to say in
> my first, poorly-worded reply, is that the set of points that are all
> 500 miles from a center point on a Mercator map will NOT form a circle
> on that map.
> If your question really is, "How can I measure the great circle
> distance between two points given their Mercator coordinates" then
> that's rather tricky. And it will depend on how far apart those two
> points are, and how accurate you need your answer to be.
> You will find incredibly talented professional expertise on this list,
> but it's hard for people to answer the question you didn't ask. If you
> can describe - in general terms, rather than specific ones - what
> you're trying to do and what questions you're trying to answer, that
> will make it easier. If there are constraints on your solution (e.g.
> "I have to use Mercator so please don't suggest an alternative
> projection that would make the math easier") let us know as well. Thanks.
> - Ed
> Ed McNierney
> 205 Indian Hill Road
> Groton, MA 01450
> ed at mcnierney.com
> +1 (978) 761-0049
> ------------------------------------------------------------------------
> _______________________________________________
> Proj mailing list
> Proj at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/proj

Proj mailing list
Proj at lists.maptools.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/proj/attachments/20080710/59648675/attachment.html

More information about the Proj mailing list