1

In GeoServer I have a layer created from a database table with the following structure:

tableX ( id,name,typeid,description,geom )

The geom field is always a polygon. I also have created 3 different styles in GeoServer, basically 3 kind of polygons with different colours.

What I'm trying to do is to serve one WMS layer with different styles, filtering them by typeid field. So, if:

  • typeid = 1 I use the first style (Green polygon)
  • typeid = 2 I use the second style (Blue polygon)
  • typeid = 3 I use the third style (Red polygon)

Is this possible in GeoServer?

2

Yes, you can create 3 separate styles with a filter that selects only the features you want styled. Or you can create one style with 3 rules each with a filter to select the required filters.

In the first case, you will see only on type of polygons at a time (unless you request the layer more than once); in the second case you will see all three types of polygon coloured differently at the same time.

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.