[Mapserver-users] (Anti)geocoding and projections...
Jan Hartmann
jhart at frw.uva.nl
Mon Apr 7 10:03:01 PDT 2003
Ed McNierney wrote:
> If you a comfortable doing the distance calculations like this in
> degrees, you can get a much better result relatively easily by
> multiplying delta longitude by the cosine of the average latitude.
> This is still not accurate , but it's much better and should work
> pretty well for short distances. It's not a geodetically precise
> solution, but I'm suggesting it in case you need a simple calculation
> that's not too bad.
>
Another method is projecting lat-lon values to the Azimuthal Equidistant
projection with central latitude and longitude at the point you are
measuring from. A characteristic of the AEQD is that all distances and
directions from the center point outward are accurate. With Warsaw as
center point that would be (with command line PROJ):
proj +proj=aeqd +lon0=21d0 +lat_0=43d10
The coordinates returned for Warsaw are obviously 0 0, as this is the
center of projection. The coordinates for e.g. Amsterdam with these
parameters are -1088.017 132.852. The distance is sqrt(1088^2 + 132^2) =
1096 km
There are several sites generating interactive maps in this projection
from a user chosen center, e.g for radio amateurs needing to know
distances and bearings measured from their own site
(http://www.wm7d.net/az_proj/az_html/azproj.shtml). In advertising, this
projection is used to make maps centered on tourist destinations, to
show visitors how accessible the site is and how many other attractions
are located nearby and in what direction.
Note that with PROJ this only works for locations on the hemisphere
around the chosen center point. Points farther away "wrap around", i.e.
show increasingly smaller distances, until the point at the exact
opposite of the globe has distance zero. I am not sure how MapServer
handles these cases: they don't look completely wrapped around, but they
also don't look like published maps as far as the outer hemisphere is
concerned.
A problem with the AEQD maps is that shape is distorted increasingly
from the center. A comparable projection is the Two Points Equidistant
projection, for which two control points have to be specified. Distances
are correct from both points to any other point on the map. Moreover,
distortion is minimal within the region of the two chosen points,
PROVIDED these are within 45 degrees of each other. Direction however
varies more than with the AEQD. The PROJ command (with Warsaw and
Amsterdam as control points) would be:
proj +proj=tpeqd +lon_1=21d0 +lat_1=52d15 +lon_2=4d54 +lat_2=52d21
A MapServer map with these parameters has minimal shape distortion for
North-West and Middle Europe and shows all distances to both cities
correctly. Directions are distorted somewhat, but for this region this
is scarcely noticeable.
This projection gives correct results in PROJ for distances larger than
a hemisphere: distance Warsaw-Melbourne: 15474 km. I'm not sure how
exact it is; it seems to have been used by Bell telephone for
calculating costs for long distance calls, so it's probably not far off
the mark.
Jan
Ed McNierney wrote:
> Krzysztof -
>
> A lot depends on how accurate you need to be, but no, I don't think using degrees as if they were square is a good idea. Take your example (Warsaw, Poland). It's at 52.25 degrees North latitude. In Warsaw, one degree of latitude is 111 km, but one degree of longitude is only 68 km. Computing simple distance as sqrt ((delta latitude) ^ 2 + (delta longitude) ^ 2) will give you very incorrect numbers.
>
> If you a comfortable doing the distance calculations like this in degrees, you can get a much better result relatively easily by multiplying delta longitude by the cosine of the average latitude. This is still not accurate , but it's much better and should work pretty well for short distances. It's not a geodetically precise solution, but I'm suggesting it in case you need a simple calculation that's not too bad.
>
> - 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
>
> -----Original Message-----
> From: Krzysztof Chodak [mailto:k.chodak at autoguard.pl]
> Sent: Friday, April 04, 2003 3:46 PM
> To: mapserver-users at lists.gis.umn.edu
> Subject: [Mapserver-users] (Anti)geocoding and projections...
>
>
> Hello again,
>
> as usual - have anyone of you got some tips...
>
> I'm trying to make simple (anti)geocoding application (it must describe
> geographic coordinates in text from available layers).
> I got conceptual problems with projectioning. As my app should find a shape
> nearest to given point i must be able to tell what is the actual ground
> distance between this to shapes. It will be a part of final string (f.e.
> "Poland, Warsaw (10km from centre)"). Currently I use "raw" unprojected
> WGS84 layers and I use standard MS functions to find closest shape - but
> closest in degrees. I could use great circle calculation to find proper
> distance in meters.
>
> Do you think that degrees seach is a proper way to find closest shape?
>
> Best regards
>
> Krzysztof Chodak
>
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>
Jan Hartmann
Department of Geography
University of Amsterdam
jhart at frw.uva.nl
More information about the MapServer-users
mailing list