getting extents for displaying individual states

G-Net Consulting joelf at GNETCONSULTING.COM
Wed Sep 8 15:32:55 EDT 2004

Strange.  Right after I sent the last email, I got it working. : )

So thanks again, everyone.  Sorry to have bothered everyone.


----- Original Message -----
From: "Eric Bridger" <eric at GOMOOS.ORG>
Sent: Monday, August 30, 2004 4:36 PM
Subject: Re: [UMN_MAPSERVER-USERS] getting extents for displaying individual

> On Mon, 2004-08-30 at 13:20, Bob Cook wrote:
>> I'm working with a map of the entire United States (including Alaska,
>> Hawaii, and other US territories).
>> I would like to allow users to select an individual state (or territory)
>> from a dropdown list and have the map center around that state, and zoom
>> in to it.
>> Is there any easy way of programmatically setting my map's extents
>> (without simply hard-coding extents for each state) so that it centers
>> on one state?
>> I'm using PHP/Mapscript.
> Assuming all your states are in one layer you will need to execute an
> attribute  query against the layer based on the name of the state
> entered.($layer->queryByAttrbute()) The query results will give you
> access to the shape of the state you want. That shape has a bounds
> member which is a rectangle which can be use to set the extent of you
> new map.
> $minx = $shape->{bounds}->{minx};
> etc.

More information about the mapserver-users mailing list