[Mapserver-users] Rendering mapscript style modifications
Frank Warmerdam
warmerdam@pobox.com
Wed, 17 Mar 2004 17:21:23 -0500
Wheaton, William D. wrote:
> But again, the map reflects what is in the .map file, not what I've changed
> in the mapscript code. The mapscript code is below-- is there something
> missing here? Do I need to specify a symbolname, symbol size etc.? Again,
> the graphic that is produced shows all of the layers in my .map file,
> including the one that is modified in mapscript. But it is ignoring the
> modifications I'm making in mapscript for that layer. Many thanks for your
> assistance!
>
> <?PHP
>
> dl('php_mapscript.so');
>
> $map = ms_newMapObj(mapscript_test.phtml);
>
> $layer=$map->getlayerbyname('Respondents');
> $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->prepareImage();
> $layer->draw($image);
> $image=$map->draw();
>
> $image_url=$image->saveWebImage(MS_PNG,1,1,0);
>
> echo("<img src=\"$image_url\">");
> ?>
William,
I am no expert on MapScript, but it seems to me you haven't done anything
to put your "default class" ahead of the default class loaded from the
mapfile. As far as I can tell after your changes, the layer will have two
classes (with no criteria) and so the first (from the mapfile) will always
be used in preference to your new one. You might try switching the classes
or actively destroying the old one.
I think something like $layer->moveclassup(1) might push your new class ahead
of the original class.
Good luck,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
_______________________________________________
Mapserver-users mailing list
Mapserver-users@lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users