[mapserver-users] FILTER on 2 or more items

Bullock, Martha F ERDC-CRREL-NH Martha.F.Bullock at erdc.usace.army.mil
Tue Mar 19 10:00:25 EST 2002


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