[MAPSERVER-USERS] php database mapfile

Kyle Wilcox Kyle.Wilcox at noaa.gov
Sun Apr 6 14:38:11 PDT 2008


http://mapserver.gis.umn.edu/docs/reference/phpmapscript-class/classes/layerobj

I believe you are looking for the 'setFilter' function.

$layer_object->setFilter("name='greece'");

Anything you put in the filter is like specifying it in a SQL WHERE. 
This is the same as doing:
SELECT the_geom FROM europe_country WHERE name='greece';



You can specify more than one constraint in the filter, such as:

$layer_object->setFilter("name='greece' AND 
i_should_have_searched_google=TRUE");


nickthegreek- wrote:
> didn't help me too much that :/ what i mean is
> 
> i have map who takes the data from a database
> 
> in the database there is a column "name"
> 
> my data are be shown with
> 
>  LAYER
> 		NAME "country"
> 		TYPE POLYGON
> 		STATUS ON
>             CONNECTIONTYPE postgis
>             CONNECTION "host=localhost dbname=postgis user=postgres
> password=d3klw7 port=5432"
>             DATA "the_geom from europe_country using unique gid using
> srid=-1"
>             LABELITEM "name"
> 
> what i wanna is.. i have a menu who takes all the countries from the column
> name...
> if i select a country 
> 
> eg.greece
> 
> how i could change the statement in the mapfile
> DATA "the_geom from europe_country using unique gid using srid=-1"
> with the statement
> DATA "the_geom from europe_country where name=greece using unique gid using
> srid=-1" so to be shown only greece??? pls help me..i need to finish my
> diploma with taht
> 
> 
> eg..i knnow if we wanna to change the status of a layer we use that
>   $this_layer = $map->getLayerByName('europe cities');
>   $this_layer->set('status', MS_ON); 
> 
> sth similar like the above to change the statement of data?
>  many thanks again
> 

-- 

  Kyle Wilcox
  NOAA Chesapeake Bay Office
  410 Severn Avenue
  Suite 107A
  Annapolis, MD 21403
  office: (410) 295-3151
  Kyle.Wilcox at noaa.gov

  A: It takes over twice as long to understand the conversation.
  Q: What's wrong with top-posting?
  A: Top-posting.
  Q: What's the worst thing about plain text email discussions?



More information about the MapServer-users mailing list