MAPSERVER-USERS Digest - 21 Oct 2006 to 22 Oct 2006 (#2006-294)
percy
percyd at PDX.EDU
Tue Oct 24 10:38:38 PDT 2006
Dylan, Here is some sample code from one of our apps here at PSU. I hope
it is useful,
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!
>
--
David Percy
Geospatial Data Manager
Geology Department
Portland State University
http://gisgeek.pdx.edu
503-725-3373
More information about the MapServer-users
mailing list