0

according to the docs of mapserver 6.0.x it is possible to load the color of a polygon shape from the shapefile. This is a great feature cos otherwise we would have to define a class for each different colored shape.

But when I create the following mapfile and read it with mapserver 5.0.4, I get a

[MapServer Error]: getSymbol(): Parsing error near (SHAPE_COLOR):(line 1192)

The class in my mapfile is:

CLASS #default coloring
    OUTLINECOLOR 0 255 0
    COLOR [SHAPE_COLOR]
END

What is the proper syntax?

  • The syntax seems correct, that is the only error you see on the debug? have you tried to increase the debug level? Maybe an attribute without an underscore? just throwing ideas... – Jorge Sanz Sep 25 '13 at 12:35
  • thanks for throwing but tried it all.. debug level is already at 5. I fixed this now by hardcoding the different classes (i only had 6 of them). But when I have to draw the world.... – jorrebor Sep 25 '13 at 12:42
  • maybe something on your attribute? it has to be an string separated by spaces right? – Jorge Sanz Sep 26 '13 at 8:28
  • yeah the string is the format 255 255 255 which seems to be correct.. – jorrebor Sep 26 '13 at 9:12
3

You are using the deprecated CLASS->COLOR notation, where attribute binding does not work. You should be using the "new" CLASS->STYLE->COLOR syntax instead, e.g.

class
 style
  color [SHAPE_COLOR]
  outlinecolor 0 255 0
 end
end

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.