I'm trying to create 1 SLD template for the Geoserver application on any point shapefile I upload. For example, I want a styling that will automatically color the attributes for the selected layer. If layer 1 has 5 unique records the styling should pull through this. enter image description here

And if I upload a different point shapefile(another layer) and select the same SLD template with more unique attributes it should automatically pull it through.

enter image description here

Please is this possible??

1 Answer 1


No, it is not possible, the rules to drive coloring need to be set statically once. It may be possible to create a new function associating a random color to unique values of a field, but it would still be problematic for tiling (would end up generating different colors for the same feature... generating the color from a hash of the class value would be another option, but it would risk generating the same color, or a color that's too similar, for two different classes).

As a better alternative, install the SLD REST service extension and call it to generate a classified style right after uploading a new shapefile.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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