3

I have a shapefile which have two fields say it is "level" and "type".

Now we want to style the map according to the value of the level and type fields.

Generally we use something rule based symbol to style the layer like this:

rule
  level=1
    style....
  level=2
    style...

However once there are multiple fields to be filtered it may change to this:

rule
  level=1 and type=1
    style....
  level=1 and type=2
    style...
  level=2 and type=1
    style...
  level=2 and type=2
    style...
  level=3 and type=1
    style...

It seems like we have to specify all the possibility of the composition of different field. Think about if there are 10+ distinct values of each field, there will be 10*10*10 kinds of rules which will be a hard job.

How do you handle this?

3

You can use the tranformation functions to get a more compact style:

Mind, you'll break GetLegendGraphics by using these functions, but with that many combinations you probably don't care.

1

CSS styling is a good way to simplify your SLD (you write CSS and it generates the XML for SLD). Could work: http://docs.geoserver.org/latest/en/user/styling/css/index.html

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.