I have a geometry table say its name is "tb_feature", and each feature have multiple tags which are saved in table "tb_tags", and the relationship is saved by another table "tb_feature_tag".

Example data:


id  the_geom
1   xxxx


1  primary
2  road
3  uncompleted


feature_id  tag_id
1           1
1           2

Now I want to style the feature based on there tags in geoserver. Generally the features are styled by different fields which are saved in the same table with the feature. But the fields used for Rule-based styleing (tags in my example) are saved in another table.

How to handle this kind of situation?


There are two ways of representing features in GeoServer simple and complex, you can construct the sort of 1-many joins that you want only in the complex features side. To use complex features you will need to add the app schema extension which will allow you to use xpath expressions in your SLD file to specify how to style features.

If you want to go with simple features then you could probably construct a view on your tables with some sort of combined tag value that can be used in a filter inside the SLD.

| improve this answer | |

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.