[mapserver-users] changing rendered color of layer dynamically?

Subha Ramakrishnan subha at gslab.com
Fri Apr 10 05:02:02 EDT 2009


Hi Steve,
Thanks for the help.It worked fine..:)

Subha
Steve Lime wrote:
> Versions 5+ use syntax like:
>
>   map.layer[india_states].class[ANDHRA%20PRADESH].style[0]=COLOR+255+0+0
>   
> There was a typo in my old message. Since you're doing WMS you could/should use SLD.
>
> Steve
>
>   
>>>> Subha Ramakrishnan <subha at gslab.com> 04/09/09 1:02 AM >>>
>>>>         
> The solution didn't work for me.
> This is my url:
> "http://localhost/cgi-bin/mapserv?MAP=india_states.map&TRANSPARENT=true&LAYERS=india_states&map.layer[india_states].class[ANDHRA%20PRADESH].style[0].color+255+0+0&FORMAT=image%2Fpng&
> PROJECTION=EPSG%3A4326&REPROJECT=false&UNITS=m&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage
> &SRS=EPSG%3A900913&BBOX=8305796.970622223,1252337.1900454492,9558141.241822222,2504681.4612454493&WIDTH=256&HEIGHT=256"
>
> I get his error: "getSymbol(): Symbol definition error. Parsing error 
> near ([):(line 1) ".
> Is there anything wrong in my url?
>
> Thanks for any help.
>
> Subha
>
> Steve Lime wrote:
>   
>> Nikos: There can be more than one style in a class to you'd need the array notation there too:
>>
>>   &map.layer[oikismoi].class[oikismoi].style[0].color+230+34+35
>>
>> Does that work?
>>
>> Steve
>>
>>   
>>     
>>>>> <nikos at maich.gr> 10/06/08 8:18 AM >>>
>>>>>         
>>>>>           
>> Hello all,
>>
>> I've been scratching my head as to how to change the color that a layer
>> maybe rendered via a form. My users want to select which color the layers
>> should be rendered.
>>
>> Would appreciate a bit of insite. I'm using FW MS 5.1-dev
>>
>> I've tried, according to the docs, using layer and class names as well as
>> layer and class index and neither work...
>>
>> &map.layer[oikismoi].class[oikismoi].style.color+230+34+35
>> &map.layer[0].class[0].style.color+230+34+35
>>
>>
>> In MS 4.something, I used to use "map_layer_0_class_0_color=255+0+0"
>> successfully
>>
>> I've also tried to use something like
>>
>> CLASS # layer color change
>>     EXPRESSION '%layer_color%'
>>     style
>>       backgroundcolor 128 128 128
>>       color 2 2 220
>>       outlinecolor 150 150 150
>>       end
>>     END
>>
>> to at least statically test a substitution, but fail...
>>
>> below is a snip from my mapfile,
>>
>> sincerely,
>>
>> nikos
>>
>>  LAYER
>>   debug 5
>>     classitem "OBJECTID"
>>     data "LANDUNIT_KARDITSA"
>>     footer "LANDUNIT_KARDITSA_footer.html"
>>     group "LANDUNIT_KARDITSA"
>>     header "LANDUNIT_KARDITSA_header.html"
>>     labelcache on
>>     labelitem "OBJECTID"
>>     name "LANDUNIT_KARDITSA"
>>     postlabelcache true
>>     status on
>>     type polygon
>>     OPACITY 70
>>     # 1 class LANDUNIT_KARDITSA
>>     class
>>      name "KARDITSA"
>>      style
>>       backgroundcolor 128 128 128
>>       #color 133 234 21
>>       color 22 200 22
>>       outlinecolor 50 50 50
>>       end
>>       template "LANDUNIT_KARDITSA_query.html"
>>     end
>>   end
>>   LAYER
>>   DEBUG 5
>>     classitem "OBJECTID"
>>     data "oikismoi"
>>     footer "oikismoi_footer.html"
>>     group "oikismoi"
>>     header "oikismoi_header.html"
>>     labelcache on
>>     labelitem "OBJECTID"
>>     name "oikismoi"
>>     postlabelcache true
>>     status on
>>     type polygon
>>     # 1 class oikismoi
>>     class
>>     name "oikismoi"
>>     style
>>       backgroundcolor 0 128 128
>>       color 22 122 233
>>       outlinecolor 0 0 0
>>       end
>>       template "oikismoi_query.html"
>>     end
>>   end
>>
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>
>>   
>>     
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>
>   



More information about the mapserver-users mailing list