[mapserver-users] Status with raster-layer-classes doesn't work

Ludwig Kniprath ludwig at kni-online.de
Thu Jun 7 03:03:58 PDT 2012


Hi List,
I'm using MS4W 3.0.6 (MapServer version 6.0.3) with PHP-mapscript, but 
this problem occured on older versions too.

I have an tile-indexed raster-layer for topografic maps (for the german 
users: it's the TK 25 from NRW).

The tiffs are colour-indexed, so I use several classes like this:

[SNIP]
CLASS
     NAME "Beschriftung"
     EXPRESSION ([pixel] = 13)
     STYLE
         COLOR 0 0 0
     END
END
[/SNIP]

I want to give the user with our web client the possibility, to hide 
some classes, so I tried the following mapscript:

[SNIP]
for($cc=0; $cc < $map_file_layer_object->numclasses; $cc++){
     $map_file_layer_object->getClass($cc)->status = $some_boolean_variable;
}
[/SNIP]

where some_boolean_variable sets the class-status to on (=visible) or 
off (=hidden).

Unfortunatly, this only works for feature-layers, but has no effect on 
raster-layers.

Hint: Setting "STATUS OFF" in the mapfile doen't work with 
raster-layers, too. The class is allways drawn.

Is this a bug or am I doing something wrong?

Ludwig

P.S.:
As workaround i got the same effect with

[SNIP]
if(!$some_boolean_variable){
     for($sc=0; $sc < $map_file_class->numstyles; $sc++){
         $map_file_class->getStyle($sc)->opacity = 0;
     }
}
[/SNIP]
but this seems too complicated...



More information about the MapServer-users mailing list