Finding Latitude and Longitude of the 4 corners of a map using mapscript.

Sean Gillies sgillies at FRII.COM
Tue Apr 26 17:08:18 EDT 2005


Just make sure to get and transform your extent *after* the map is
drawn because msDrawMap will fudge the map extents to fit the specified
image size.

cheers,
Sean

On Apr 26, 2005, at 2:57 PM, James Sohr wrote:

> Yes, you can calculate the lat long of your current extent by using the
> RectObj's project method. For instance:
>
>
>    $latlong_rect = $map->extent;
>    $latlong_rect->project( ms_newprojectionobj($map->getProjection),
> ms_newprojectionobj("proj=latlong"));
>
>
>
> Assuming $map is your map object, the latitudes and longitudes of the
> four
> corners of your map are now stored in $latlong_rect->minx,
> $latlong_rect-
>> miny, $latlong_rec->maxx, and $latlong_rect->maxy .
>
>
--
Sean Gillies
sgillies at frii dot com
http://users.frii.com/sgillies



More information about the mapserver-users mailing list