[Mapserver-users] Turning on/off parts of layer based on expression

Steve Lime steve.lime at dnr.state.mn.us
Thu Feb 20 10:21:27 EST 2003


With mapscript you can set class status. That's not the case with the
CGI version yet. A workaround
might be to try using the syntax "map_layername_class_i_status=ON/OFF"
where layername is well,
the layer name and i is the class number. I've not tried this but it
*should* work. You'd have to use
javascript to maintain state between map draws since there are no
substitutions like [layername_check]
to use. A planned modification to 3.7 is to use class NAME just like
layer name and to use another
parameter to store legend names. If that happens then classes can be
treated just like layers in the
CGI application.

You may be able to use expressions as well. The CGI version allows you
to pass form values directly
into expressions so you could do something like:

<intput type="checkbox" name="c1" value="1"> class 1
<intput type="checkbox" name="c2" value="2"> class 2
<intput type="checkbox" name="c3" value="3"> class 3

and then have an expression like:

EXPRESSION ([someitem] IN '%c1%,%c2%,%c2')

or you each class could contain a single expression.

CLASSITEM someitem
CLASS
  EXPRESSION '%c1%'
END
CLASS
  EXPRESSION '%c2%'
END
CLASS
  EXPRESSION '%c3%'
END

Expressions wouldn't be true unless the user had selected the class in
the interface. Again, you'd
use javascript to maintain state.

All sorts of possibilities, just need to be creative.

Steve

>>> "Steve McCrone (maps at work)" <mccrone at pc.jaring.my> 02/20/03 07:45AM
>>>
Currently I am turning on/off the layers using check boxes, and I am
using
pure cgi mapserver and the rosa applet.
Fine, works well. Now, is it possible to turn on/off parst of the
layer
(based on expression value) interactively (like check boxes). The
reason
being is that I have one table with say 200 different clasifications
and I
want the user to turn on/off a selected classification. I really do not
wish
to break up the shape file into 250 different files.

Thanks


_______________________________________________
Mapserver-users mailing list
Mapserver-users at lists.gis.umn.edu 
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users



More information about the mapserver-users mailing list