Click -> map coords

Eric Bridger eric at GOMOOS.ORG
Wed Dec 22 10:07:59 EST 2004


I don't know about a "standard" way. I usually pick a width (x) first.
Then use algebra to calculate my height (y). E.g. a width of 600 with
extents:
EXTENT -71.50 39.5 -63.0 46.0

Units and signs don't matter since it's ratios.

height = (maxy - miny / maxx - minx) * width
height = 6.5/8.5 * 600  (round to nearest whole number)

SIZE 600 459

Mapserver itself is much more intelligent about all this so you could
look in the source code and try and create a more reliable perl routine.
See setExtent(), msAdjustExtent() and some MACROS is map.h.

Eric

On Wed, 2004-12-22 at 03:57, Aaron Craig wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> That's what I figured.  My question now is this:  is there a
> "standard" way of going from map extent to an 'optimum' SIZE setting
> in the mapfile?
>
> Eric Bridger wrote:
>
>
> | On Tue, 2004-12-21 at 05:25, Aaron Craig wrote:
> |
> |
> | The above function will only work when your map's SIZE matches your
> |  map's EXTENTS. That is the aspect ratio's must match. E.g. w/h =
> | maxx - minx / maxy - miny or width/height  =  max longitude - min
> | longitude/ max latitude - min latitude. (I think I have this right)
> |
> |
> | The easiest thing to do is just adjust your map SIZE. Should get
> | rid of your white areas as well.
> |
> |
> |
> |
>
> - --
> Aaron Craig
> mercutio at pobox.com
>
> ===========================================================
> Get Firefox!
> http://www.spreadfirefox.com/?q=affiliates&id=0&t=1
> ===========================================================
>
> - -=-=-
>
> Falstaff sweats to death and lards the lean earth as he walks along.
> - --I Henry IV, II:2
>
> - -=-=-
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.3-nr1 (Windows 2000)
> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
>
> iD8DBQFByTb7oyEQRcU83p4RAuXYAJ4yICOEJQXf29yS69koAga6FsXDfACcClB/
> q4rz9FITSaN9Q94J9f9ObDE=
> =S9/8
> -----END PGP SIGNATURE-----
>



More information about the mapserver-users mailing list