[mapserver-users] Scale calculation ?
Doyon, Jean-Francois
Jean-Francois.Doyon at ccrs.nrcan.gc.ca
Fri Feb 1 13:59:28 PST 2002
Hello,
Im having bit of problem, not really mapserver related, but with all the
knowledgeable people here I thoguht I'd try :)
I've got the following map extent:
-1442903,1246771,-1958558,3366821
(These are Meters, LCC)
Now if I look at this extent with MapServer, it tells me the scale is:
15840015.370266
(This with a GIF of 428x380)
Now if I use the following formula (Taken from the MapServer source):
md = width/(resolution*inchesPerUnit[units]); // was (width-1)
gd = extent.maxx - extent.minx;
which translates into:
reqscale = ( -1958558 - -1442903 ) / ( 428 / ( 72 * 39.3701 ) )
in python
I consistently get a different result:-3415186.92036
(Or just take the positive version of this, whiich is what you get if you
swap minx and miny)
Now the value MapServer returns is right ...
But what's wrong with MY calculation ??? I need to be able to get to the
same number MapServer comes up with. Up 'till now this was working fine ...
but not anymore it seems :(
I'm no GIS guru, so any help figuring this out would be greatly appreciated
:)
Thanks :)
Jean-François Doyon
Internet Service Development and Systems Support
GeoAccess Division
Canadian Center for Remote Sensing
Natural Resources Canada
http://atlas.gc.ca
Phone: (613) 992-4902
Fax: (613) 947-2410
More information about the MapServer-users
mailing list