<HTML>
<HEAD>
<TITLE>Re: [Proj] Re: Distance measured in Mercator projection</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Shannon -<BR>
<BR>
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 ;-)<BR>
<BR>
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.<BR>
<BR>
- Ed<BR>
<BR>
Ed McNierney<BR>
205 Indian Hill Road<BR>
Groton, MA 01450<BR>
<a href="ed@mcnierney.com">ed@mcnierney.com</a><BR>
+1 (978) 761-0049<BR>
<BR>
<BR>
<BR>
On 7/10/08 7:02 AM, "Shannon Scott" <<a href="sscott@locationinc.com">sscott@locationinc.com</a>> wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Thank you all for your comments.<BR>
1m / cos (phi) was the formula I was looking for.<BR>
<BR>
We have an application that maps data based on a search radius ( ie 5<BR>
miles around Chicago ).<BR>
The maps show the search radius. We had been using UTM for the maps, so<BR>
I was able to plot the search radius with this piece of code:<BR>
<snip><BR>
// convert miles to meters<BR>
bufdist = (miles * 1609.344);<BR>
<BR>
// create circle<BR>
for (double i=0;i<360;i+=5) {<BR>
deltax = (Math.cos(i) * bufdist);<BR>
deltay = (Math.sin(i) * bufdist);<BR>
pntx = (centerPntx + deltax);<BR>
pnty = (centerPnty + deltay);<BR>
// plot point<BR>
}<BR>
</snip><BR>
<BR>
The maps have been converted to work as a google map overlay, so we need<BR>
to use the Mercator projection.<BR>
I have modified the way the search radius is calculated:<BR>
<snip><BR>
// convert miles to meters<BR>
bufdist = (miles * (Math.abs(1609.344 * (1/Math.cos(latrad)))));<BR>
</snip><BR>
<BR>
and everything looks good.<BR>
Thanks again.<BR>
Shannon<BR>
<BR>
<BR>
Ed McNierney wrote:<BR>
> Shannon -<BR>
><BR>
> First, let me apologize for trying to respond (twice) when I was too<BR>
> rushed to do so properly.<BR>
><BR>
> Since you say you’re not very familiar with map projections, it might<BR>
> be helpful for you to describe a little bit more about what you’re<BR>
> trying to do. Daan’s and Chris’s comments are both correct but could<BR>
> be confusing to a novice; the scale factor at a single point is the<BR>
> same in all directions for a Mercator projection, but strictly<BR>
> speaking only at that point. If you have another point in a different<BR>
> place, the scale factor at that point will be different from the first<BR>
> unless they’re at exactly the same latitude. So if you’re measuring<BR>
> the distance between two points at a non-trivial distance apart, a<BR>
> 500-mile line will, for example, change length on a Mercator map<BR>
> depending on its angle with the Equator. What I was trying to say in<BR>
> my first, poorly-worded reply, is that the set of points that are all<BR>
> 500 miles from a center point on a Mercator map will NOT form a circle<BR>
> on that map.<BR>
><BR>
> If your question really is, “How can I measure the great circle<BR>
> distance between two points given their Mercator coordinates” then<BR>
> that’s rather tricky. And it will depend on how far apart those two<BR>
> points are, and how accurate you need your answer to be.<BR>
><BR>
> You will find incredibly talented professional expertise on this list,<BR>
> but it’s hard for people to answer the question you didn’t ask. If you<BR>
> can describe – in general terms, rather than specific ones – what<BR>
> you’re trying to do and what questions you’re trying to answer, that<BR>
> will make it easier. If there are constraints on your solution (e.g.<BR>
> “I have to use Mercator so please don’t suggest an alternative<BR>
> projection that would make the math easier”) let us know as well. Thanks.<BR>
><BR>
> - Ed<BR>
><BR>
> Ed McNierney<BR>
> 205 Indian Hill Road<BR>
> Groton, MA 01450<BR>
> <a href="ed@mcnierney.com">ed@mcnierney.com</a><BR>
> +1 (978) 761-0049<BR>
> ------------------------------------------------------------------------<BR>
><BR>
> _______________________________________________<BR>
> Proj mailing list<BR>
> <a href="Proj@lists.maptools.org">Proj@lists.maptools.org</a><BR>
> <a href="http://lists.maptools.org/mailman/listinfo/proj">http://lists.maptools.org/mailman/listinfo/proj</a><BR>
<BR>
_______________________________________________<BR>
Proj mailing list<BR>
<a href="Proj@lists.maptools.org">Proj@lists.maptools.org</a><BR>
<a href="http://lists.maptools.org/mailman/listinfo/proj">http://lists.maptools.org/mailman/listinfo/proj</a><BR>
<BR>
</SPAN></FONT></BLOCKQUOTE>
</BODY>
</HTML>