phpmapscript: changing a layer's style

Aaron Racicot aaronr at Z-PULLEY.COM
Mon Oct 23 14:58:17 PDT 2006


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/class
obj

http://mapserver.gis.umn.edu/docs/reference/phpmapscript-class/classes/style
obj

http://mapserver.gis.umn.edu/docs/reference/phpmapscript-class/classes/color
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



More information about the MapServer-users mailing list