[Mapserver-users] Rendering mapscript style modifications

Wheaton, William D. wdw at rti.org
Wed Mar 17 15:09:40 EST 2004


Hello all:

I'm having a basic conceptual problem understanding the interaction between
the modification of a layer in php/mapscript and then rendering those
modifications...I've searched far and wide in the e-mail archives, but I
guess I'm just missing some basic concept here.  

Given a .map file with several layers, then:

1) $map = ms_newMapObj(file.map);

For the layer I want to change, the .map file looks like this:
LAYER
     PROJECTION
         "proj=latlong"
         "ellps=clrk66"
      END
      CONNECTIONTYPE postgis
      NAME "Respondents"
      GROUP "Base Data"
      CONNECTION "user=xxxx dbname=xxx password=xxxx"
      DATA "the_geom from resp"
      STATUS DEFAULT
      TYPE POINT
      METADATA
            LYRNAME "Respondents"
      END
  CLASS
         STYLE
		       COLOR 255 0 0
		 END
   END
END

2) Then, through php/mapscript, grab this layer and change its style:

$layer=$map->getlayerbyname('Respondents');

3) Modify the style of this layer:

$class=ms_newClassObj($layer);
$style=ms_newStyleObj($class);
$style->color->setRGB(0,255,0);
$class->set("status", MS_ON);
$layer->set("status", MS_ON);
$image=$map->draw();
$image_url=$image->saveWebImage(MS_PNG,1,1,0);

4) With this, the map gets drawn with the layer symbology as specified in
the .map file, not with the modifications made above in the mapscript...

So, I have a basic problem understanding how modifications to a layer in a
mapscript file get rendered on the map...Is it order?  Am I missing a
something?

Many thanks in advance for any help.  I'm at my wits end!




More information about the mapserver-users mailing list