Mapfile REGEXPs (was Re: point file filter)

Stephen Lime steve.lime at dnr.state.mn.us
Tue Feb 6 08:13:51 PST 2001


Use logical expressions here, not regex. The expression for 'Greater than 401 Beds'
would be EXPRESSION ([TOTAL_BEDS] > 400) and so on. It's possible to do this
with regex but it's easier the logicals.

Steve

Stephen Lime
Internet Applications Analyst

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937

>>> "Kieran J. Ames" <kames at keyspanenergy.com> 02/06/01 08:26AM >>>
Maybe I could add my own question here...
I'd like to try using REGEXPs in a mapfile to do the same thing. I have a list of
hospital facilities where I'm enumerating the total number of beds. I want to render
the data based on the number of beds. I tried evaluating the number of TOTAL_BEDS,
but can only get it to work as follows. What I'd like to do is say something like:
EXPRESSION/> 400/
as opposed to
EXPRESSION /[4-9][1-9][0-9]/
Thanks,
Kieran

snippet follows...

    CLASSITEM TOTAL_BEDS
  CLASS
    NAME 'Greater than 401 Beds'
       SIZE 5
       EXPRESSION /[4-9][1-9][0-9]/
       COLOR 0 0 0
      SYMBOL 1
  END

      CLASS
    NAME '250-400 Beds'
        SIZE 4
        EXPRESSION /^[2-3][5-9][0-9]$|^3[0-9][0-9]$/
        COLOR 0 0 255
        SYMBOL 1
     END  # CLASS


Stephen Lime wrote:

> You can use dynamic expressions to do that. Let's say you have a mapfile with
> a point layer called "mypoints" with a single class. You can set up a select list
> to set the expression for that class:
>
>   <select name="map_mypoints_class_expression" single>
>     <option value="expression"> option 1</option>
>     <option value="expression"> option 2</option>
>     ...
>   </select>
>
> The expressions can be any valid MapServer (i.e. string, logical or regular)
> expression. Syntax of the expression is identical to that entered in a map
> file.
>
> Steve
>
> Stephen Lime
> Internet Applications Analyst
>
> Minnesota DNR
> 500 Lafayette Road
> St. Paul, MN 55155
> 651-297-2937
>
> >>> <Alexspringer at aol.com> 02/03/01 05:06PM >>>
> Using the mapserver cgi, I have a point file in use.  I would like to add a
> select [drop down box] that has values for a filter to be applied to one
> field in the point file dbf so that only those records with the field value
> equal to that filter display.  Does anyone have an example of the .map and
> .htm that can demonstrate how this is implemented?
>
> Thank you.
>




More information about the MapServer-users mailing list