[mapserver-users] Scale calculation ? (Solved)

Doyon, Jean-Francois Jean-Francois.Doyon at ccrs.nrcan.gc.ca
Tue Feb 5 09:28:36 EST 2002


Hello,

OK I figured out the problem.  I guess it was part me, part mapserver
behavior.

What I had done sometime last year was create a list of extents for various
places in Canada (Provinces/Territories/Major Cities) ...

That list works fine.

Then I took those same extents to apply them to a new tool I've got, and
started noticing the mentionned problems.  As you mentionned, the extent is
wrong.  The funny thing is , it still takes me to the right place!  In
retrospect, I'd like to remember how I came up with that extent below ... it
really shouldn't work I guess ... when I pass that extent to MapServer, I
get a map back drawn with completely different ones!

I'm guessing MapServer notices that some of them make no sense and then does
"something" to try and fix it ...

Anyways I found my way around it :)

Sorry about that ...

Thanks!
J.F.

-----Original Message-----
From: Steve Lime [mailto:steve.lime at dnr.state.mn.us]
Sent: Friday, February 01, 2002 6:16 PM
To: Jean-Francois.Doyon at ccrs.nrcan.gc.ca
Subject: Re: [mapserver-users] Scale calculation ?


If I read your extent right your x values are reversed (i.e. -1958558 is
smaller than -1442903).

Steve

Stephen Lime
Data & Applications Manager

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937

>>> "Doyon, Jean-Francois" <Jean-Francois.Doyon at ccrs.nrcan.gc.ca>
02/01/02 03:59PM >>>
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