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

nikos at maich.gr nikos at maich.gr
Mon Oct 6 04:50:58 PDT 2008


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




More information about the MapServer-users mailing list