Fw: Calculate extents based on points
Joel Firestone
mms at GNETCONSULTING.COM
Mon Jan 31 09:34:27 PST 2005
Camden:
Thanks for the tip. I'll give it a try.
Joel
----- Original Message -----
From: "Camden Daily" <cdaily at GMAIL.COM>
To: <MAPSERVER-USERS at LISTS.UMN.EDU>
Sent: Monday, January 31, 2005 12:25 PM
Subject: Re: [UMN_MAPSERVER-USERS] Fw: Calculate extents based on points
> Maybe this would work:
>
> Calculate half your extent
> $offset_x = ($max_x - $min_x) / 2;
> $offset_y = ($max_y - $min_y) / 2;
>
> Find the midpoint
> $mid_x = $max_x - $offset_x;
> $mid_y = $max_y - $offset_y;
> $mid_point = ms_newpointObj();
> $mid_point->setXY($mid_x, mid_y);
>
> Make your new extent
> $new_extent = array($longitude - $offset_x, $latitude - $offset_y,
> $longitude + $offset_x, $latitude + $offset_y);
>
> Zoom to the new point with the new extents
> $map->zoompoint(1, $mid_point, $map->width, $map->height, $new_extent);
>
More information about the MapServer-users
mailing list