phpmapscript: changing a layer's style

Dylan Beaudette dylan.beaudette at GMAIL.COM
Mon Oct 23 16:29:17 PDT 2006


Thanks Aaron,

that did the trick.

We have converted our mapserver app to ka-map, and thus i need to learn some 
mapscript!

However, with your advice I was able to solve this small problem. Doing 
anything interesting with GRASS these days?

Cheers,

Dylan

PS here is a link to our new ka-map application:
http://casoilresource.lawr.ucdavis.edu/drupal/node/27


On Monday 23 October 2006 14:58, Aaron Racicot wrote:
> Hi there Dylan,
>
> Have not had the chance to say HI in a while... Great to see some GRASS
> guru's diving into Mapserver!
>
> You might already be doing something similar to this but:
>
> 1) You need to get the CLASS object
> 2) Then you need to get the STYLE object within that class using the
> following:
>    styleObj getStyle(int index)
>         Return the style object using an index. index >= 0 &&
>         index < class->numstyles.
> 3) Then you can use the set method of the STYLE object for things other
> than color, but since colors are of type colorObj you need to set them
> directly using the setRGB method.
>
> Something like:
>   $style = $class->getStyle(1);
>   $style->color->setRGB($red,$green,$blue);
>   $style->outlinecolor->setRGB(0,0,0);
>
> Check out the docs at:
> http://mapserver.gis.umn.edu/docs/reference/phpmapscript-class/classes/clas
>s obj
>
> http://mapserver.gis.umn.edu/docs/reference/phpmapscript-class/classes/styl
>e obj
>
> http://mapserver.gis.umn.edu/docs/reference/phpmapscript-class/classes/colo
>r obj
>
>
> Hope this helps.
>
> Aaron
>
> +----------------------------------------+
>
> | Aaron Racicot  | aaronr at ecotrust.org   |
> | GIS Programmer | 360.221.2441          |
>
> +----------------------------------------+
>
> | e c o t r u s t                        |
> | Jean Vollum Natural Capital Center     |
> | 721 NW Ninth Avenue                    |
> | Suite 200                              |
> | Portland, OR 97209                     |
> | www.ecotrust.org                       |
>
> +----------------------------------------+
>
> -----Original Message-----
> From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
> Behalf Of Dylan Beaudette
> Sent: Monday, October 23, 2006 3:03 PM
> To: MAPSERVER-USERS at LISTS.UMN.EDU
> Subject: Re: [UMN_MAPSERVER-USERS] phpmapscript: changing a layer's style
>
> Thanks for the tips,
>
> however this does not *appear* to work for STYLE objects within a CLASS
> object...
>
> I have tried extracting the classObj and setting a parameter with:
>
> class->set('outlinecolor', '100 100 100')
>
> however this does not work.
>
> dylan

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



More information about the MapServer-users mailing list