Change color on Mapserver

anhtin anhtin at GMAIL.COM
Mon Jul 16 00:06:37 PDT 2007


hi all i have project using asp.net, Mapserver And Database Postgis
i have problem with change dynamic color on classObj

this is layer on map file:
LAYER
   #MainRoad
   NAME "MainRoad"
    STATUS OFF
    CONNECTIONTYPE postgis
    CONNECTION "host=127.0.0.1 dbname=vietnamairlines user=postgres
password=123456 port=5432"
    DATA "the_geom FROM mainroad" 
    TYPE LINE   
   MINSCALE 90000 
    CLASS
      STYLE
        COLOR 0 0 0
       SIZE 4
      END
    END
END

and this layer have colunm on database: gid,name,code,the_geom
I want to change dynamic color some Line on Mapserver
i try

layerObj layer = objMapServer.getLayerByName("MainRoad");
classObj objclass = layer.getClass(1);
styleObj objstyle = objclass.getStyle(0);

colorObj objColor = new colorObj(184, 212, 252, 0);
objstyle.color = objColor; 

if i define class in map file is:
CLASS
      NAME "Hoa Binh"
      EXPRESSION ([code]=305)
      STYLE
        COLOR 182 249 252 
      END
   END

it change color successful.
but with my layer "main road" have many item class so i can't define in map
file
and now i think a way is create new classObj and assign to this layer ("Main
Road")
but i dont know how will i do that.
if u can solve it. could u show me!
-- 
View this message in context: http://www.nabble.com/Change-color-on-Mapserver-tf4084861.html#a11610134
Sent from the Mapserver - User mailing list archive at Nabble.com.



More information about the MapServer-users mailing list