phpmapscript: changing a layer's style [solved]

Dylan Beaudette dylan.beaudette at GMAIL.COM
Tue Oct 24 20:46:21 EDT 2006


thanks percy, i will keep this for future reference. This type of information 
is not as nicely spelled out in the mapserver docs.

Cheers,


On Tuesday 24 October 2006 13:32, percy wrote:
> Dylan, Here is some sample code from one of our apps here at PSU. I hope
> it is useful. Sorry everyone for the re-post, but I did the bonehead
> error of not changing the subject line, so if anyone was following
> Dylan's thread they would not know that this was posted...
> Percy
>
> //start sample code
>      $cities=ms_newLayerObj($map);
>      $cities->set("name", "Cities");
>      $cities->set("data", "all_cities_dissolved");
>      $cities->set("type", MS_LAYER_POLYGON);
>      $cities->set("status", MS_OFF);
>      $cities->set("transparency", 20);
>      $cities->set("classitem", "NAME");
>      $cities->setProjection($projection);
>      //next few lines are to enable querry
>      $cities->set("group", "Selectable Layers");
>      $cities->setMetaData("Description", "City");
>      $cities->setMetaData("Result_Fields", "NAME");
>      $cities->setMetaData("Group", "Selectable Layers");
>      $cities->setMetaData("Layer", "cities");
>
>      $class_cities_lrg=ms_newClassObj($cities);
>      $class_cities_lrg->set("name", "Large Cities");
>      $class_cities_lrg->setExpression("/Metro Area/");
>      $class_cities_lrg->set("maxscale", 10000000);
>      $class_cities_lrg->set("minscale", 5000001);
>      $style_cities_lrg=ms_newStyleObj($class_cities_lrg);
>      $style_cities_lrg->color->setRGB(255,255,255);
>      $class_cities_lrg->set("template", "ttt_query.html");
>
>      $class_cities_med=ms_newClassObj($cities);
>      $class_cities_med->set("name", "Medium & Large Cities");
>      $class_cities_med->setExpression("([AREA] > 0.01)");
>      $class_cities_med->set("maxscale", 5000000);
>      $class_cities_med->set("minscale", 500001);
>      $style_cities_med=ms_newStyleObj($class_cities_med);
>      $style_cities_med->color->setRGB(255,255,255);
>      $class_cities_med->set("template", "ttt_query.html");
> //end sample code
>
> MAPSERVER-USERS automatic digest system wrote:
> > There is 1 message totalling 26 lines in this issue.
> >
> > Topics of the day:
> >
> >   1. phpmapscript: changing a layer's style
> >
> > ----------------------------------------------------------------------
> >
> > Date:    Sun, 22 Oct 2006 21:47:47 -0700
> > From:    Dylan Beaudette <dylan.beaudette at GMAIL.COM>
> > Subject: phpmapscript: changing a layer's style
> >
> > Greetings,
> >
> > is there a simple way to change an existing layer's style?
> >
> > so far i am able to change a layer's filter expression, etc. but not able
> > to adjust the style defined in the first class.
> >
> > any examples out there?
> >
> > thanks in advance!

-- 
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341



More information about the mapserver-users mailing list