getting extents for displaying individualstates

temiz temiz at DEPREM.GOV.TR
Thu Sep 9 02:14:28 EDT 2004


hello

your message is very informative.
I wonder how the query section of map file is ?
I will appreciate if you supply this information

regards

Ahmet Temiz


G-Net Consulting wrote:

> Hello list:
>
> I'm attempting to do the same thing, but keep hitting a hurdle,
> and have yet to find a solution in the archives.  Here's my code:
>
> // get our state layer
>  $stLayer = $gmfMap->getLayer(1);
>  $stLayer->set("status", MS_ON);
>
>  // query the passed state
>  $qryLayer = $stLayer->queryByAttributes("STATE", $_GET["state"],
> MS_MULTIPLE);
>
>  // find out how many results we found
>  $shpCount = $stLayer->GetNumResults();
>
>  // open the layer
>  $stLayer->open();
>
>  // find out how many results we found
>  for ($i = 0; $i < $shpCount; $i++) {
>   // get the results we need from the layer
>   $result = $stLayer->getResult($i);
>
>   // get our shape info from the index
>   $shpData = $stLayer->getShape($result->tileindex, $result->shapeindex);
>
>      print_r($result);
>      // ... (do something with the result)
>  }
>
> When I get to the getShape() function, I get an error saying "Invalid
> feature id."
> I know it has to be something simple.  I, too, am trying to get the
> extents
> for
> a passed state to "zoom" into it.  Layer #1 is my states layer.
>
> I'm using PHP/MapScript (4.x+ versions).
>
> TIA!
>
> Joel
>
> ----- Original Message -----
> From: "Eric Bridger" <eric at GOMOOS.ORG>
> To: <MAPSERVER-USERS at lists.umn.edu>
> Sent: Monday, August 30, 2004 4:36 PM
> Subject: Re: [UMN_MAPSERVER-USERS] getting extents for displaying
> individual
> states
>
>
>> 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.
>>
>
>


______________________________________
Inflex - installed on mailserver for domain @deprem.gov.tr
Queries to: postmaster at deprem.gov.tr

______________________________________
The views and opinions expressed in this e-mail message are the sender's own
and do not necessarily represent the views and the opinions of Earthquake Research Dept.
of General Directorate of Disaster Affairs.

Bu e-postadaki fikir ve gorusler gonderenin sahsina ait olup, yasal olarak T.C.
B.I.B. Afet Isleri Gn.Mud. Deprem Arastirma Dairesi'ni baglayici nitelikte degildir.



More information about the mapserver-users mailing list