compensate scale for longitude

Jacob Delfos jacob.delfos at MAUNSELL.COM
Wed Aug 18 21:41:47 EDT 2004


Ed,
 
Thanks for the tip. I think it would be best if I generate a custom sized scalebar. I'm doing that anyway for creating a printable layout of a larger size. I'll just have to adjust the scaling a bit more. I know it's not enirely precise, but it will only be for indicative purposes then.
 
Jacob
 
 
-----Original Message-----
From: Ed McNierney [mailto:ed at topozone.com] 
Sent: 19 August 2004 09:30
To: Delfos, Jacob; MAPSERVER-USERS at LISTS.UMN.EDU
Subject: RE: [UMN_MAPSERVER-USERS] compensate scale for longitude


Jacob -
 
There's nothing wrong with insisting that the Earth is flat - but don't measure that flat Earth with longitude and latitude!
 
I'm not trying to be a nag, but I'm not saying you "shouldn't" do it - I'm saying you can't.  Your scale bar will be incorrect if it uses units other than degrees (which are rather meaningless anyway, since a degree of latitude isn't the same as a degree of longitude).  So don't expect MapServer to generate what is essentially a non-cartographic scale bar, but rather just a pretty picture <g>.
 
Your scale, except at the Equator, will be incorrect in all directions except one.  So you can choose which one is going to be correct  If you want to force MapServer to produce a scalebar for a different map, use the "mode=scalebar" command, and adjust the width and height of the (non-existent) map image.  MapServer will generate an appropriate scalebar image for this map image which is not the map image you're displaying on the screen but rather one that is distorted by the cosine of the latitude.  Does that make sense?
 
It's also easy enough to tell MapServer to project the output image in, say, a UTM projection, and actually produce an accurate scalebar, too!  It might even be less work than fudging it.
 
    - Ed
 
Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA  01863
Phone: +1 978 251-4242   Fax: +1 978 251-1396 



--------------------------------------------------------------------------------
From: Delfos, Jacob [mailto:jacob.delfos at maunsell.com] 
Sent: Wednesday, August 18, 2004 9:14 PM
To: Ed McNierney
Subject: RE: [UMN_MAPSERVER-USERS] compensate scale for longitude


Ed,
 
Sorry, I meant latitude. I always get those mixed up. I know I shouldn't be performing 'to scale' sort of things in a geographic projection. It's just that I have those tools on the website, but I want to allow the user to change the projection without those tools having to be removed. I guess I will just have to put up a little warning.
 
No wonder it took so long for people to accept the world is round. It's not that they didn't believe it possible, but for convenience sake they just refused to accept it.
 
regards,
 
Jacob
 
 
 
-----Original Message-----
From: Ed McNierney [mailto:ed at topozone.com] 
Sent: 18 August 2004 22:00
To: Jacob Delfos; MAPSERVER-USERS at LISTS.UMN.EDU
Subject: RE: [UMN_MAPSERVER-USERS] compensate scale for longitude


Jacob -
 
I don't think this is something MapServer should be expected to do.  I am assuming that you're using a "geographic" projection for your output data - is that correct?  If so, the width of one degree on longitude depends on the *latitude*  (not the longitude) and the width of one degree of latitude is approximately constant.  But on any given map the scale (in meters) north/south is different from the scale east/west - there isn't a single "correction" you can make to fix that.  The scale is constant in "degrees" but varies with the position AND ANGLE in meters.
 
If you need a map in which units can be measured in a scale of meter, you should use a projected map.  Otherwise you're just not going to be able to do it accurately - with or without MapServer's help.
 
    - Ed
Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA  01863
Phone: +1 978 251-4242   Fax: +1 978 251-1396 




--------------------------------------------------------------------------------
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On Behalf Of Jacob Delfos
Sent: Wednesday, August 18, 2004 2:31 AM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: [UMN_MAPSERVER-USERS] compensate scale for longitude


Hi List,
 
I've been working on getting my "print to scale" code to work properly when working in latitude/longitude. I had a consistent error, and now realize it's because mapserver seems to ignore the longitude when converting from degrees to metres. I was wondering if that is something that could be changed. My code actually did compensate for it, which is why my scale (which is wrapped around the mapserver scale) did not match my scalebarsize after printing. It's quite a simple compensation; it's just a matter of taking the number which is currently calculated for the size of a pixel, and multiplying it with the cosine of the longitude (I use the longitude of the centre of the map). Of course the scale would not be the same throughout the map if your extent is large, but it will be a lot closer. In Perth the difference is around 15%. Where in the code should this be changed?
 
regards,
 
Jacob
 
 
 
JACOB DELFOS
SPATIAL INFORMATION ANALYST
Maunsell Australia Pty Ltd
629 Newcastle Street
PO Box 81
Leederville 6902
Western Australia
ABN 20 093 846 925
 
Tel     + 61 8 9281 6185
Fax    + 61 8 9281 6297
jacob.delfos at maunsell.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20040819/ccc3f507/attachment.html


More information about the mapserver-users mailing list