Decimal degree units

Banister Trevor TBanister at SpaceImaging.com
Thu Aug 26 13:58:03 EDT 1999


I'll try the PROJ.4 support, but I'm guessing that the performance hit will
kill me. Some of my maps have thousands of shapes on several layers.

I can live with some error at the edges of the map since that's true for
Geographic space in general, the further towards the poles you go the more
error in the map.

Here's some formulas that should do the trick.
(courtesy of Gene Dial, our GIS guru)

DX = Re * (Lon1 - Lon2) * PI / 180
DY = Re * (Lat1 - Lat2) * (PI / 180) * Cos( Lat)

Converting the other way:
180 * DX / (PI * Re) = (Lon1 - Lon2)
180 * DY / (PI * Re * cos(lat)) = (Lat1 - Lat2)

Re = radius of earth =
6,370,997 meters (average) * 254 inches/meter =
1,618,233,238 inches

Lat = (Lat1+Lat2)/2
PI/180 factors convert Lat and Lon from degrees to radians
DX = EW distance
DY = NS distance


Trevor

-----Original Message-----
From: Stephen Lime [mailto:steve.lime at dnr.state.mn.us]
Sent: Thursday, August 26, 1999 10:27 AM
To: mapserver-users at lists.gis.umn.edu; TBanister at SpaceImaging.com
Subject: Re: Decimal degree units


I'd love to see it supported, but have been unable to figure out an easy
way to account for changing measures as you move around. There is
no one conversion from DD to inches. It would be easy to figure an
average x cellsize value for a map, then one could figure out the dd to
inches
conversion factor and with that you could calculate a scale. Scales are
rough to begin with as they are monitor dependent. MapServer uses a
pixels/inch value of 72 to generate scales.

To add DD support only 3 things have to change. 

  - add MS_DD to ms_units enumeration in map.h
  - change the lexer to recognize a DD keyword in mapfiles (edit mapfile.h,
mapfile.c and maplexer.l)

I could do that easily. Rebuilding the lexer requires flex.

  - edit msCalculateScale function in mapscale.c to deal with the nuances of
DD

Anyone got ideas/code to figure out DD to inches relationship depending on
where
you are in the world?

The other workaround is to project your data on-the-fly using the Proj.4
library. A bit slower
as every coordinate is projected but it does work.

Steve

Stephen Lime
Internet Applications Analyst
MIS Bureau - MN DNR

(651) 297-2937
steve.lime at dnr.state.mn.us

>>> Banister Trevor <TBanister at SpaceImaging.com> 08/26 11:07 AM >>>
Is anyone using decimal degree units?
It looks like they aren't supported from the looks of map.h
enum ms_units {MS_INCHES, MS_FEET, MS_MILES, MS_METERS, MS_KILOMETERS};
I've gotten the shape files to work ok, but I have to fake a unit type which
throws off the legend and absolute zoom factor.
Any work arrounds? or should I start coding DD support?

Thanks.

Trevor




More information about the mapserver-users mailing list