[mapserver-users] FILTER on 2 or more items

Stepan Kafka stepan.kafka at centrum.cz
Wed Mar 20 04:42:40 PST 2002


You can use this syntax in the map file:

FILTER ("[ST_NAME]" = "%state%" and "[POLY_TYPE]" = "S")

in this case you need only submit "state" parameter from your form.

You can pass also use whole expression via "map_stmap_filter" parameter,
e.g.:

..&map_stmap_filter=("[ST_NAME]"="NY" and "POLY_TYPE" ="S")&...


> -----Pùvodní zpráva-----
> Od: owner-mapserver-users at lists.gis.umn.edu
> [mailto:owner-mapserver-users at lists.gis.umn.edu]za uživatele Bullock,
> Martha F ERDC-CRREL-NH
> Odesláno: 19. bøezna 2002 16:00
> Komu: 'mapserver-users at lists.gis.umn.edu'
> Pøedmìt: [mapserver-users] FILTER on 2 or more items
>
>
> Dear MapServer List:
>
> I would like to filter an itemnquery with an expression involving
> 2 or more
> items.
> I can filter on one item - the FILTERITEM - by sending MapServer a regular
> expression of the value(s) (i.e. ST_NAME = NY).
> However, I can't seem to get the syntax correct to send it an expression
> involving 2 or more items (i.e. ST_NAME = NY and POLY_TYPE = S).
>
> When I try to build an expression (see examples in lines 3-5 below), my
> search "... returned no results. No matching record(s) found."
>
> Does anyone have any hints as to how I should format my equation to
> correctly filter and display the layer?
>
> Thanks!  martha
>
> Potential Equations:
> (Line 2) works, but lines 3)-5) don't)
>
> 1)   selstate = document.mapserv.stater.value;   // stater = text box to
> enter state name
> 2)  stexp = "/" + selstate + "/";        //  ** WORKS
> 3)  //  stexp = "ST_NAME = /" + selstate + "/ and POLY_TYPE = /S/";    //
> ** test
> 4)  // stexp = "'ST_NAME' = /" + selstate + "/ and 'POLY_TYPE' =
> /S/"    //
> ** test
> 5)  // stexp = "[ST_NAME] = /" + selstate + "/ and [POLY_TYPE] =
> /S/"    //
> ** test
> 6)   document.mapserv.map_stmap_filter.value = stexp;
>
> Map file layer definition:
>
> LAYER
>   NAME stmap
>   DATA data/usstates
>   TYPE polygon
>   STATUS default
>   FILTERITEM ST_NAME
>  # FILTER "%stater%"
>   TEMPLATE querytest.html
>   CLASSITEM "ST"
>   CLASS  # red
>     EXPRESSION /53|11|12|15|19|20|26|28|33|34|38|44|49|54|60/
>     SYMBOL 0
>     COLOR 255 153 153
>     .
>     .
>     .
>   END
>
>
>




More information about the MapServer-users mailing list