# [Mapserver-users] Distance Calculation

Ed McNierney ed at topozone.com
Fri Mar 5 10:21:13 EST 2004

```This is a multi-part message in MIME format.

------_=_NextPart_001_01C402C5.7F02C354
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Sr. Guy -
=20
No, that's not even close.  You need to understand at least a little
about the UTM projection in order to use it.  The PROJ library is a good
tool and the one MapServer uses - you can learn a LOT about it from the
PROJ site at http://www.remotesensing.org/proj
=20
And please introduce yourself to people who are spending quite a bit of
time helping you - thanks!
=20
- Ed
=20
Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA  01863
ed at topozone.com
(978) 251-4242=20

_____ =20

From: Map Guy [mailto:mappington at yahoo.com]=20
Sent: Friday, March 05, 2004 10:18 AM
To: Ed McNierney
Cc: mapserver-users at lists.gis.umn.edu
Subject: RE: [Mapserver-users] Distance Calculation

Ok. The extent unit needs to match the output projection unit. So if we
have been working in lat/long decimal degrees, is it safe to do
something like:
=20
mapRectObj.minx=3DMapXml->minx * 1855.398 * 60; // lat in degrees * =
1'
in m * 60'
mapRectObj.miny=3DMapXml->miny * 1855.398 * 60;
mapRectObj.maxx=3DMapXml->maxx * 1855.398 * 60;
mapRectObj.maxy=3DMapXml->maxy * 1855.398 * 60;

where MapXml->minx, etc. are in decimal degrees. Or, do we have to
account for where these are in order to figure out the factor for
conversion to meters?
=20
And, does the same thing go when we try to figure out the pixel
coordinate, like in this case:
=20
centerPixelX=3Drint((MapXml->referencePoint->longitude -
Map->extent.minx)/Scale);

where MapXml->referencePoint->longitude is in decimal degrees.
=20
Thanks.

Ed McNierney <ed at topozone.com> wrote:

Mr. Guy -
=20
1. If your output map images are to be in the UTM (or any other)
projection, then your EXTENT needs to be expressed in the native units
of that projection.  So yes, you do need to express your EXTENT in
meters.
=20
2. You do NOT have to convert your data.  Read the MapServer
documentation about projections; you can have source data layers in any
projection or as unprojected lat/lon degrees and MapServer will project
the data on the fly to produce the output map.  This works very well.
=20
- Ed
Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA  01863
ed at topozone.com
(978) 251-4242=20

_____ =20

From: Map Guy [mailto:mappington at yahoo.com]=20
Sent: Friday, March 05, 2004 9:59 AM
To: Ed McNierney
Cc: mapserver-users at lists.gis.umn.edu
Subject: RE: [Mapserver-users] Distance Calculation
=09
=09
Thank you very much for your help so far.
=20
Up to this point we have been making all of calculations for our
maps in lat/long degrees. So, for instance, our map extent is given in
lat/long degrees. This acts as a window into our source geographic
pjoection layers. Based on what you have said, we now want our output to
be projected to UTM. Do we now need to convert all of our lat/long
degrees to meters for this to work (what is a good way to do this, if
so)? An example would be our map extent - does this now need to be in
meters? Is there no way to specify everything in lat/long degrees for
accessing our source data and then have the end result projected to UTM?
Our map file (simplified) is at the end of this email.=20
=20
NAME MAPREQUEST
SYMBOLSET "maprequest.sym"
EXTENT -178.226733 18.914590 -66.953248 71.381356 # Set
dynamically (Does this now need to be in meters?)
SIZE  586 586
UNITS DD # What should this be?
TRANSPARENT OFF
FONTSET "maprequest.fon"
IMAGECOLOR  204 255 255
IMAGETYPE PNG
SHAPEPATH /layers/

PROJECTION
"init=3Depsg:26915"
END
=09
LAYER
NAME "Boundary"
DATA "cty90"
STATUS ON
TYPE POLYGON
TEMPLATE "foo"
CLASS
COLOR 255 255 204
OUTLINECOLOR  255 255 204
END
PROJECTION
"proj=3Dlatlong"
END
END
=09
Thanks again!
=20

Ed McNierney <ed at topozone.com> wrote:

Yes, that helps a lot.  First, you MUST project your
data if you're going to create a raster image of it, unless your users
have ellipsoidal monitor screens <g>.  Using lat/lon coordinates as X/Y
coordinates is a projection, too - it's just not a very useful one for
most purposes.  If you're going to measure distances you need
appropriately projected maps.
=20
You might do best with the UTM projection family.  It is
simple, common, and easy to use.  It is not an equidistant projection
and there will be a VERY small distortion, but for areas as small as
yours I think it will be completely invisible.  There are other more
accurate projections (equidistant conic, for example) that require more
=20
You do, however, need to choose the appropriate UTM zone
for each map you make, based on the longitude of the center point.  If
you try to make a map that is very small scale (showing a large portion
of the country) it will look strange around the edges.  But if you make
maps of less than a few hundred miles in extent no one will notice.
=20
- Ed
=20
Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA  01863
ed at topozone.com
(978) 251-4242=20

_____ =20

From: Map Guy [mailto:mappington at yahoo.com]=20
Sent: Wednesday, March 03, 2004 3:29 PM
To: Ed McNierney
Cc: mapserver-users at lists.gis.umn.edu
Subject: RE: [Mapserver-users] Distance Calculation
=09
=09
We are trying to map underlying layers like streets,
parks, cities, etc. taken from TIGER for the United States. Then on top
of this we are drawing a ring usually less than 20 miles with the center
being the center of the map. Then we are mapping points given to us with
lat/lon. In the legend we put the distance of the point from the center
of the map. It is this distance which when done with Great Circle calc
raised the red flag because the distance would put the point outside the
circle when it was being drawn inside the circle. If we used Cartesian
distance, then the distance would be off.=20
=20
order for our distance shown in the legend to be accurate and also match
what we draw on the map, right?
=20
Thanks and let me know if you need more detail to
provide suggestions.

Ed McNierney <ed at topozone.com> wrote:=20

I don't know what a "Cartesian" distance in
miles means when your units are in degrees and the conversion between
degrees and miles depends on the length and the orientation of the line.
=20
As I said, if you can provide more detail we can
offer more advice.  For example, if all your distances are at a "small
scale", that's more detail (you didn't say that before).  That helps
define the problem better and helps us suggest solutions.  Please
describe the problem you're trying to solve and we'll help!
=20
- Ed
Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA  01863
ed at topozone.com
(978) 251-4242=20

_____ =20

From: Map Guy [mailto:mappington at yahoo.com]=20
Sent: Wednesday, March 03, 2004 3:15 PM
To: Ed McNierney
Cc: mapserver-users at lists.gis.umn.edu
Subject: RE: [Mapserver-users] Distance
Calculation
=09
=09
I know it is a very simple question, but I
didn't think the results would be so different at such a small scale.
Would you tell me if these results seem right:
=20
Point 1 (Lon,Lat): -87.6552,41.9148
Point 2 (Lon,Lat): -87.8081,41.8884
=20
Cartesian Distance between Point 1 and 2 in
miles: 11.2
Great Circle (assuming sphere) Distance between
Point 1 and 2: 8.1=20
=20
Thanks again.
=09
Ed McNierney <ed at topozone.com> wrote:

list.  That way everyone benefits from the conversation, and the first
commitment to further questions!
=20
Yes, of course you can choose one
projection for your entire set of data.  Or you could switch based on
what you're mapping.  The reason there are so many map projections is
because each has different properties, and therefore does some things
well and other things less well.  The classic Mercator projection is
excellent if you are navigating with a compass; it is very poor if
you're trying to persuade someone that Brazil is several times larger
than Greenland.
=20
You also need to have a feel for what
level of accuracy you need for your measurements.  The UTM family of
projections is popular in part because it allows fairly accurate
distance measurements, does not distort shapes badly, and is easy to
use.  However, you need 10 different UTM zones to cover the lower 48
states.  If you need even more accuracy a custom Transverse Mercator
projection centered on the longitude of your central point would be
better.
=20
Mapping large areas in a single map is
harder to do in an appealing way than mapping small areas, because
spatial distortion becomes more obvious.
=20
If you can provide a bit more detail on
what you're trying to do we can offer more advice.
=20
- Ed
Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA  01863
ed at topozone.com
(978) 251-4242=20

_____ =20

From: Map Guy
[mailto:mappington at yahoo.com]=20
Sent: Wednesday, March 03, 2004 2:01 PM
To: Ed McNierney
Subject: RE: [Mapserver-users] Distance
Calculation
=09
=09
Thank you for your quick response.
=20
Is it possible to choose one projection
for my entire set of data which includes the whole United States (TIGER
data). Or, do I somehow have to switch based on what I am mapping? If
the latter is true, then do you have a suggestion on how I would do
that?
=20
Again, point me elsewhere if I am
pushing in the wrong direction.
=20
Thank you,
=20
Map Guy
=09
Ed McNierney <ed at topozone.com> wrote:

Dear Map Guy -
=20
If you draw an 8-mile ring on a
"geographic projection" map it will not be a circle.  If you create a
map with a 20-mile extent it will not be a square.
=20
Maps using "geographic projection" are
useless for making distance measurements; you simply cannot do them in
any kind of sensible way.  The width of the top edge (east-west) of your
"20 mile" image is DIFFERENT than the width of the bottom edge.  In
fact, each row of pixels running across the image has a different width
in miles/feet/meters because they're all different distances from the
Equator.  That's why the set of all points 8 miles from a given point is
not a circle or ring; it's not even an ellipse.
=20
You need to choose a projected
coordinate system in order to do reasonable distance measurements.
=20
- Ed
=20
Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA  01863
ed at topozone.com
(978) 251-4242=20

_____ =20

From: Map Guy
[mailto:mappington at yahoo.com]=20
Sent: Wednesday, March 03, 2004 12:21 PM
To: mapserver-users at lists.gis.umn.edu
Subject: [Mapserver-users] Distance
Calculation
=09
=09
We use TIGER data for our mapping data
source. We use a geographic projection (lat/lon). When we draw an 8 mile
ring on a map with a 20 mile extent, and we plot a point and calculate
the distance from the center using Great Circle we get 7.5 miles. Using
a Cartesian calculation we get 8.2 miles.=20
=20
2 questions:
=20
1. Should we be seeing this much
difference in distances?
=20
2. What is the correct way to draw a
ring on a map using a geographic projection (lat/lon) and display
distances between points using Great Circle without the distance placing
the point incorrectly inside or outside the ring?
=20
=20
P.S. Point me somewhere else if this is
the wrong place to ask these questions.

=09
_____ =20

Do you Yahoo!?
Yahoo! Search - Find what you're looking

=09
_____ =20

Do you Yahoo!?
Yahoo! Search - Find what you're looking

=09
_____ =20

Do you Yahoo!?
Yahoo! Search - Find what you're looking for

=09
_____ =20

Do you Yahoo!?
Yahoo! Search - Find what you're looking for faster.

=09
_____ =20

Do you Yahoo!?
Yahoo! Search - Find what you're looking for faster.

_____ =20

Do you Yahoo!?
Yahoo! Search - Find what you're looking for faster.

------_=_NextPart_001_01C402C5.7F02C354
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<BODY>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D798481915-05032004><FONT =
face=3DArial=20
color=3D#0000ff size=3D2>Sr. Guy -</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D798481915-05032004><FONT =
face=3DArial=20
color=3D#0000ff size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D798481915-05032004><FONT =
face=3DArial=20
color=3D#0000ff size=3D2>No, that's not even close.&nbsp; You need to =
understand at=20
least a little about the UTM projection in order to use it.&nbsp; The =
PROJ=20
library is a good tool and the one MapServer uses - you can learn a LOT =
from the PROJ site at <A=20
href=3D"http://www.remotesensing.org/proj">http://www.remotesensing.org/p=
roj</A></FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D798481915-05032004><FONT =
face=3DArial=20
color=3D#0000ff size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D798481915-05032004><FONT =
face=3DArial=20
color=3D#0000ff size=3D2>And please introduce yourself to people who are =
spending=20
quite a bit of time helping you - thanks!</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D798481915-05032004><FONT =
face=3DArial=20
color=3D#0000ff size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><SPAN =
class=3D798481915-05032004>&nbsp;&nbsp;&nbsp; <FONT=20
face=3DArial color=3D#0000ff size=3D2>- Ed</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D798481915-05032004><FONT =
face=3DArial=20
color=3D#0000ff size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D798481915-05032004>
<P><FONT size=3D2>Ed McNierney<BR>President and Chief =
Mapmaker<BR>TopoZone.com /=20
Maps a la carte, Inc.<BR>73 Princeton Street, Suite 305<BR>North =
Chelmsford,=20
MA&nbsp; 01863<BR>ed at topozone.com<BR>(978) 251-4242 =
</FONT></P></SPAN></DIV><BR>
<HR tabIndex=3D-1>
<FONT face=3DTahoma size=3D2><B>From:</B> Map Guy =
[mailto:mappington at yahoo.com]=20
<BR><B>Sent:</B> Friday, March 05, 2004 10:18 AM<BR><B>To:</B> Ed=20
McNierney<BR><B>Cc:</B> =
mapserver-users at lists.gis.umn.edu<BR><B>Subject:</B> RE:=20
[Mapserver-users] Distance Calculation<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV>Ok. The extent unit needs to match the output projection unit. So =
if we=20
have been working in lat/long decimal degrees, is it safe to do =
something=20
like:</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; mapRectObj.minx=3DMapXml-&gt;minx * 1855.398 * =
60; // lat=20
in degrees * 1' in m * 60'<BR>&nbsp;&nbsp;&nbsp; =
mapRectObj.miny=3DMapXml-&gt;miny=20
* 1855.398 * 60;<BR>&nbsp;&nbsp;&nbsp; mapRectObj.maxx=3DMapXml-&gt;maxx =
*=20
1855.398 * 60;<BR>&nbsp;&nbsp;&nbsp; mapRectObj.maxy=3DMapXml-&gt;maxy * =
1855.398=20
* 60;<BR></DIV>
<DIV>where MapXml-&gt;minx, etc. are in decimal degrees. Or, do we have =
to=20
account for where these are in order to figure out the factor for =
conversion to=20
meters?</DIV>
<DIV>&nbsp;</DIV>
<DIV>And, does the same thing go when we try to figure out the pixel =
coordinate,=20
like in this case:</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;=20
centerPixelX=3Drint((MapXml-&gt;referencePoint-&gt;longitude -=20
Map-&gt;extent.minx)/Scale);<BR></DIV>
<DIV>where MapXml-&gt;referencePoint-&gt;longitude&nbsp;is in decimal=20
degrees.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks.<BR><BR><B><I>Ed McNierney &lt;ed at topozone.com&gt;</I></B>=20
wrote:</DIV>
<BLOCKQUOTE class=3Dreplbq=20
style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px =
solid">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D578375914-05032004><FONT =
face=3DArial=20
color=3D#0000ff size=3D2>Mr. Guy -</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D578375914-05032004><FONT =
face=3DArial=20
color=3D#0000ff size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D578375914-05032004><FONT =
face=3DArial=20
color=3D#0000ff size=3D2>1. If your output map images are to be in the =
UTM (or any=20
other) projection, then your EXTENT needs to be expressed in the =
native units=20
of that projection.&nbsp; So yes, you do need to express your EXTENT =
in=20
meters.</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D578375914-05032004><FONT =
face=3DArial=20
color=3D#0000ff size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D578375914-05032004><FONT =
face=3DArial=20
color=3D#0000ff size=3D2>2. You do NOT have to convert your =
MapServer documentation about projections; you can have source data =
layers in=20
any projection or as unprojected lat/lon degrees and MapServer will =
project=20
the data on the fly to produce the output map.&nbsp; This works very=20
well.</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D578375914-05032004><FONT =
face=3DArial=20
color=3D#0000ff size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><SPAN =
class=3D578375914-05032004>&nbsp;&nbsp;&nbsp;=20
<FONT face=3DArial color=3D#0000ff size=3D2>- Ed</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D578375914-05032004>
<P><FONT size=3D2>Ed McNierney<BR>President and Chief =
Mapmaker<BR>TopoZone.com /=20
Maps a la carte, Inc.<BR>73 Princeton Street, Suite 305<BR>North =
Chelmsford,=20
MA&nbsp; 01863<BR>ed at topozone.com<BR>(978) 251-4242=20
</FONT></P></SPAN></DIV><BR>
<HR tabIndex=3D-1>
<FONT face=3DTahoma size=3D2><B>From:</B> Map Guy =
[mailto:mappington at yahoo.com]=20
<BR><B>Sent:</B> Friday, March 05, 2004 9:59 AM<BR><B>To:</B> Ed=20
McNierney<BR><B>Cc:</B> =
mapserver-users at lists.gis.umn.edu<BR><B>Subject:</B>=20
RE: [Mapserver-users] Distance Calculation<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV>Thank you very much for your help so far.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Up to this point we have been making all of calculations for our =
maps in=20
lat/long degrees. So, for instance, our map extent is given in =
lat/long=20
degrees. This acts as a window into our source geographic pjoection =
layers.=20
Based on what you have said, we now want our output to be projected to =
UTM. Do=20
we now need to convert all of our lat/long degrees to meters for this =
to work=20
(what is a good way to do this, if so)? An example would be our map =
extent -=20
does this now need to be in meters? Is there no way to specify =
everything in=20
lat/long degrees for accessing our source data and then have the end =
result=20
projected to UTM? Our map file (simplified) is at the end of this =
email.=20
</DIV>
<DIV>&nbsp;</DIV>
<DIV>NAME MAPREQUEST<BR>SYMBOLSET "maprequest.sym"<BR>EXTENT =
-178.226733=20
18.914590 -66.953248 71.381356 # Set dynamically (Does this now need =
to be in=20
meters?)<BR>SIZE&nbsp; 586 586<BR>UNITS DD # What should this=20
be?<BR>TRANSPARENT OFF<BR>FONTSET "maprequest.fon"<BR>IMAGECOLOR&nbsp; =
204 255=20
255<BR>IMAGETYPE PNG<BR>SHAPEPATH /layers/</DIV>
<DIV><BR>PROJECTION<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
"init=3Depsg:26915"<BR>END<BR></DIV>
<DIV>LAYER<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NAME=20
"Boundary"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DATA=20
"cty90"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; STATUS=20
ON<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TYPE=20
POLYGON<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TEMPLATE=20
"foo"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
=
CLASS<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;=20
COLOR 255 255=20
=
204<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;=20
OUTLINECOLOR&nbsp; 255 255 =
204<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
END<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
=
PROJECTION<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
"proj=3Dlatlong"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
END</DIV>
<DIV>END<BR><BR>Thanks again!</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR><B><I>Ed McNierney &lt;ed at topozone.com&gt;</I></B> =
wrote:</DIV>
<BLOCKQUOTE class=3Dreplbq=20
style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px =
solid">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D284524120-03032004><FONT =
face=3DArial=20
color=3D#0000ff size=3D2>Yes, that helps a lot.&nbsp; First, you =
MUST project=20
your data if you're going to create a raster image of it, unless =
have ellipsoidal monitor screens &lt;g&gt;.&nbsp; Using lat/lon =
coordinates=20
as X/Y coordinates is a projection, too - it's just not a very =
useful one=20
for most purposes.&nbsp; If you're going to measure distances you =
need=20
appropriately projected maps.</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D284524120-03032004><FONT =
face=3DArial=20
color=3D#0000ff size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D284524120-03032004><FONT =
face=3DArial=20
color=3D#0000ff size=3D2>You might do best with the UTM projection =
family.&nbsp;=20
It is simple, common, and easy to use.&nbsp; It is not an =
equidistant=20
projection and there will be a VERY small distortion, but for areas =
as small=20
as yours I think it will be completely invisible.&nbsp; There are =
other more=20
accurate projections (equidistant conic, for example) that require =
more work=20
<DIV dir=3Dltr align=3Dleft><SPAN class=3D284524120-03032004><FONT =
face=3DArial=20
color=3D#0000ff size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D284524120-03032004><FONT =
face=3DArial=20
color=3D#0000ff size=3D2>You do, however, need to choose the =
appropriate UTM=20
zone for each map you make, based on the longitude of the center=20
point.&nbsp; If you try to make a map that is very small scale =
(showing a=20
large portion of the country) it will look strange around the =
edges.&nbsp;=20
But if you make maps of less than a few hundred miles in extent no =
one will=20
notice.</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D284524120-03032004><FONT =
face=3DArial=20
color=3D#0000ff size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><SPAN =
class=3D284524120-03032004>&nbsp;&nbsp;&nbsp;=20
<FONT face=3DArial color=3D#0000ff size=3D2>- Ed</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D284524120-03032004><FONT =
face=3DArial=20
color=3D#0000ff size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D284524120-03032004>
<P><FONT size=3D2>Ed McNierney<BR>President and Chief =
Mapmaker<BR>TopoZone.com=20
/ Maps a la carte, Inc.<BR>73 Princeton Street, Suite 305<BR>North=20
Chelmsford, MA&nbsp; 01863<BR>ed at topozone.com<BR>(978) 251-4242=20
</FONT></P></SPAN></DIV><BR>
align=3Dleft>
<HR tabIndex=3D-1>
<FONT face=3DTahoma size=3D2><B>From:</B> Map Guy =
[mailto:mappington at yahoo.com]=20
<BR><B>Sent:</B> Wednesday, March 03, 2004 3:29 PM<BR><B>To:</B> Ed=20
McNierney<BR><B>Cc:</B> =
mapserver-users at lists.gis.umn.edu<BR><B>Subject:</B>=20
RE: [Mapserver-users] Distance Calculation<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial size=3D2><SPAN=20
class=3D577011319-03032004>We are trying to map underlying layers =
like=20
streets, parks, cities, etc. taken from TIGER for the United States. =
Then on=20
top of this we are drawing a ring usually less than 20 miles with =
the center=20
being the center of the map. Then we are mapping points given to us =
with=20
lat/lon. In the legend we put the distance of the point from the =
center of=20
the map. It is this distance which when done with Great Circle calc =
raised=20
the red flag because the distance would put the point outside the =
circle=20
when it was being drawn inside the circle. If we used Cartesian =
distance,=20
then the distance would be off. </SPAN></FONT></DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial size=3D2><SPAN=20
class=3D577011319-03032004></SPAN></FONT>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial size=3D2><SPAN=20
project our data=20
in order for our distance shown in the legend to be accurate and =
also match=20
what we draw on the map, right?</SPAN></FONT></DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial size=3D2><SPAN=20
class=3D577011319-03032004></SPAN></FONT>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial size=3D2><SPAN=20
class=3D577011319-03032004>Thanks and let me know if you need more =
detail to=20
provide suggestions.</SPAN></FONT></DIV><BR><BR><B><I>Ed McNierney=20
&lt;ed at topozone.com&gt;</I></B> wrote:=20
<BLOCKQUOTE class=3Dreplbq=20
style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff =
2px solid">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D336382120-03032004><FONT =
face=3DArial=20
color=3D#0000ff size=3D2>I don't know what a "Cartesian" distance =
in miles=20
means when your units are in degrees and the conversion between =
degrees=20
and miles depends on the length and the orientation of the=20
line.</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D336382120-03032004><FONT =
face=3DArial=20
color=3D#0000ff size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D336382120-03032004><FONT =
face=3DArial=20
color=3D#0000ff size=3D2>As I said, if you can provide more detail =
we can=20
offer more advice.&nbsp; For example, if all your distances are at =
a=20
"small scale", that's more detail (you didn't say that =
before).&nbsp; That=20
helps define the problem better and helps us suggest =
solutions.&nbsp;=20
Please describe the problem you're trying to solve and we'll=20
help!</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D336382120-03032004><FONT =
face=3DArial=20
color=3D#0000ff size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><SPAN =
class=3D336382120-03032004>&nbsp;&nbsp;&nbsp;=20
<FONT face=3DArial color=3D#0000ff size=3D2>- =
Ed</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D336382120-03032004>
<P><FONT size=3D2>Ed McNierney<BR>President and Chief=20
Mapmaker<BR>TopoZone.com / Maps a la carte, Inc.<BR>73 Princeton =
Street,=20
Suite 305<BR>North Chelmsford, MA&nbsp; =
01863<BR>ed at topozone.com<BR>(978)=20
251-4242 </FONT></P></SPAN></DIV><BR>
align=3Dleft>
<HR tabIndex=3D-1>
<FONT face=3DTahoma size=3D2><B>From:</B> Map Guy=20
[mailto:mappington at yahoo.com] <BR><B>Sent:</B> Wednesday, March =
03, 2004=20
3:15 PM<BR><B>To:</B> Ed McNierney<BR><B>Cc:</B>=20
mapserver-users at lists.gis.umn.edu<BR><B>Subject:</B> RE: =
[Mapserver-users]=20
Distance Calculation<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV>I know it is a very simple question, but I didn't think the =
results=20
would be so different at such a small scale. Would you tell me if =
these=20
results seem right:</DIV>
<DIV>&nbsp;</DIV>
<DIV>Point 1 (Lon,Lat): <FONT =
size=3D2>-87.6552,41.9148</FONT></DIV>
<DIV>Point 2 (Lon,Lat): <FONT size=3D2>-87.8081,<FONT=20
size=3D2>41.8884</FONT></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>Cartesian Distance between Point 1 and 2 in miles: 11.2</DIV>
<DIV>Great Circle (assuming sphere) Distance between Point 1 and =
2: 8.1=20
</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks again.<BR><BR><B><I>Ed McNierney=20
&lt;ed at topozone.com&gt;</I></B> wrote:</DIV>
<BLOCKQUOTE class=3Dreplbq=20
style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff =
2px solid">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2><SPAN=20
entire=20
list.&nbsp; That way everyone benefits from the conversation, =
and the=20
first person to answer your question doesn't have to make a =
commitment to further questions!</SPAN></FONT></DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2><SPAN=20
class=3D577011319-03032004></SPAN></FONT>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2><SPAN=20
class=3D577011319-03032004>Yes, of course you can choose one =
projection=20
for your entire set of data.&nbsp; Or you could switch based on =
what=20
you're mapping.&nbsp; The reason there are so many map =
projections is=20
because each has different properties, and therefore does some =
things=20
well and other things less well.&nbsp; The classic Mercator =
projection=20
is excellent if you are navigating with a compass; it is very =
poor if=20
you're trying to persuade someone that Brazil is several times =
larger=20
than Greenland.</SPAN></FONT></DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2><SPAN=20
class=3D577011319-03032004></SPAN></FONT>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2><SPAN=20
class=3D577011319-03032004>You also need to have a feel for what =
level of=20
accuracy you need for your measurements.&nbsp; The UTM family of =

projections is popular in part because it allows fairly accurate =

distance measurements, does not distort shapes badly, and is =
easy to=20
use.&nbsp; However, you need 10 different UTM zones to cover the =
lower=20
48 states.&nbsp; If you need even more accuracy a custom =
Transverse=20
Mercator projection&nbsp;centered on the longitude of your =
central point=20
would be better.</SPAN></FONT></DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2><SPAN=20
class=3D577011319-03032004></SPAN></FONT>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2><SPAN=20
class=3D577011319-03032004>Mapping large areas in a single map =
is harder=20
to do in an appealing way than mapping small areas, because =
spatial=20
distortion becomes more obvious.</SPAN></FONT></DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2><SPAN=20
class=3D577011319-03032004></SPAN></FONT>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2><SPAN=20
class=3D577011319-03032004>If you can provide a bit more detail =
on what=20
you're trying to do we can offer more =
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2><SPAN=20
class=3D577011319-03032004></SPAN></FONT>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2><SPAN=20
class=3D577011319-03032004>&nbsp;&nbsp;&nbsp; - =
Ed</SPAN></FONT></DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2><SPAN=20
class=3D577011319-03032004>
<P><FONT size=3D2>Ed McNierney<BR>President and Chief=20
Mapmaker<BR>TopoZone.com / Maps a la carte, Inc.<BR>73 Princeton =
Street,=20
Suite 305<BR>North Chelmsford, MA&nbsp;=20
01863<BR>ed at topozone.com<BR>(978) 251-4242=20
</FONT></P></SPAN></FONT></DIV><BR>
align=3Dleft>
<HR tabIndex=3D-1>
<FONT face=3DTahoma size=3D2><B>From:</B> Map Guy=20
[mailto:mappington at yahoo.com] <BR><B>Sent:</B> Wednesday, March =
03, 2004=20
2:01 PM<BR><B>To:</B> Ed McNierney<BR><B>Subject:</B> RE:=20
[Mapserver-users] Distance Calculation<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV>Thank you for your quick response.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Is it possible to choose one projection for my entire set =
of data=20
which includes the whole United States (TIGER data). Or, do I =
somehow=20
have to switch based on what I am mapping? If the latter is =
true, then=20
do you have a suggestion on how I would do that?</DIV>
<DIV>&nbsp;</DIV>
<DIV>Again, point me elsewhere if I am pushing in the wrong=20
direction.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thank you,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Map Guy<BR><BR><B><I>Ed McNierney =
&lt;ed at topozone.com&gt;</I></B>=20
wrote:</DIV>
<BLOCKQUOTE class=3Dreplbq=20
style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: =
#1010ff 2px solid">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<DIV dir=3Dltr align=3Dleft><SPAN =
class=3D606261418-03032004><FONT=20
face=3DArial color=3D#0000ff size=3D2>Dear Map Guy =
-</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN =
class=3D606261418-03032004><FONT=20
face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><SPAN =
class=3D606261418-03032004><FONT=20
face=3DArial color=3D#0000ff size=3D2>If you draw an 8-mile =
ring on a=20
"geographic projection" map it will not be a circle.&nbsp; If =
you=20
create a map with a 20-mile extent it will not be a=20
square.</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN =
class=3D606261418-03032004><FONT=20
face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><SPAN =
class=3D606261418-03032004><FONT=20
face=3DArial color=3D#0000ff size=3D2>Maps using "geographic =
projection" are=20
useless for making distance measurements; you simply cannot do =
them in=20
any kind of sensible way.&nbsp; The width of the top edge =
(east-west)=20
of your "20 mile" image is DIFFERENT than the width of the =
bottom=20
edge.&nbsp; In fact, each row of pixels running across the =
image has a=20
different width in miles/feet/meters because they're all =
different=20
distances from the Equator.&nbsp; That's why the set of all =
points 8=20
miles from a given point is not a circle or ring; it's not =
even an=20
ellipse.</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN =
class=3D606261418-03032004><FONT=20
face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><SPAN =
class=3D606261418-03032004><FONT=20
face=3DArial color=3D#0000ff size=3D2>You need to choose a =
projected=20
coordinate system in order to do reasonable distance=20
measurements.</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN =
class=3D606261418-03032004><FONT=20
face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><SPAN=20
class=3D606261418-03032004>&nbsp;&nbsp;&nbsp; <FONT =
face=3DArial=20
color=3D#0000ff size=3D2>- Ed</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN =
class=3D606261418-03032004><FONT=20
face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D606261418-03032004>
<P><FONT size=3D2>Ed McNierney<BR>President and Chief=20
Mapmaker<BR>TopoZone.com / Maps a la carte, Inc.<BR>73 =
Princeton=20
Street, Suite 305<BR>North Chelmsford, MA&nbsp;=20
01863<BR>ed at topozone.com<BR>(978) 251-4242=20
</FONT></P></SPAN></DIV><BR>
align=3Dleft>
<HR tabIndex=3D-1>
<FONT face=3DTahoma size=3D2><B>From:</B> Map Guy=20
[mailto:mappington at yahoo.com] <BR><B>Sent:</B> Wednesday, =
March 03,=20
2004 12:21 PM<BR><B>To:</B>=20
mapserver-users at lists.gis.umn.edu<BR><B>Subject:</B> =
[Mapserver-users]=20
Distance Calculation<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV>We use TIGER data for our mapping data source. We use a=20
geographic projection (lat/lon). When we draw an 8 mile ring =
on a map=20
with a 20 mile extent, and we plot a point and =
calculate&nbsp;the=20
distance from the center&nbsp;using Great Circle we get 7.5 =
miles.=20
Using a Cartesian calculation we get 8.2 miles. </DIV>
<DIV>&nbsp;</DIV>
<DIV>2 questions:</DIV>
<DIV>&nbsp;</DIV>
<DIV>1. Should we be seeing this much difference in =
distances?</DIV>
<DIV>&nbsp;</DIV>
<DIV>2. What is the correct way to draw a ring on a map using =
a=20
geographic projection (lat/lon) and display distances between =
points=20
using Great Circle without the distance placing the point =
incorrectly=20
inside or outside the ring?</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>P.S. Point me somewhere else if this is the wrong place =
these questions.</DIV>
<P>
<HR SIZE=3D1>
Do you Yahoo!?<BR>Yahoo! Search - <A=20
what you&#8217;re=20
looking for faster.</A> </BLOCKQUOTE>
<P>
<HR SIZE=3D1>
Do you Yahoo!?<BR>Yahoo! Search - <A=20
you&#8217;re=20
looking for faster.</A> </BLOCKQUOTE>
<P>
<HR SIZE=3D1>
Do you Yahoo!?<BR>Yahoo! Search - <A=20
you&#8217;re=20
looking for faster.</A> </BLOCKQUOTE></DIV>
<P>
<HR SIZE=3D1>
Do you Yahoo!?<BR>Yahoo! Search - <A=20
you&#8217;re looking=20
for faster.</A> </BLOCKQUOTE>
<P>
<HR SIZE=3D1>
Do you Yahoo!?<BR>Yahoo! Search - <A=20
you&#8217;re looking=20
for faster.</A> </BLOCKQUOTE>
<P>
<HR SIZE=3D1>
Do you Yahoo!?<BR>Yahoo! Search - <A=20