Is there any api,pulgin for generating SLD?

Note: I want to generate SLD programatically. I have property stored in database from which i would like to generate sld. I also want to generate various different tag according to geometry type like polygon, line or point. Currently I am going xml way.


I am looking for all the ways that I could generate SLD. So I have tagged the question with java and openlayers. It may be client side by openlayers or server side by java. I don't want to concatenate string or genrate xml. Is there any other way then this?

I have layers with multiple columns or I have multiple tables with multiple columns. Now I want to set predefined parameters like point size point color or polygon size and color in database and create SLD.

I want to use SLD with openlayers. Generating xml is fine but I wanted to know if there are other good ways.

var sld = '<StyledLayerDescriptor version ="1.0.0" ...> more xml here </StyledLayerDescriptor>';  

wms = new OpenLayers.Layer.WMS.Post(
      'layers': 'myNs:layername',
      format: 'image/jpeg',
      sld_body: sld
      unsupportedBrowsers: []
  • 1
    Where will you generate the SLD? On the server? In the client? You need to give us more details. Oct 4, 2013 at 11:52
  • @DevdattaTengshe Edited :) !
    – kinkajou
    Oct 5, 2013 at 1:14
  • 1
    It still isn't very clear. "All the ways" is pretty exhaustive. Can you tell us what you're currently doing (in more detail than "xml way"), what the constraints are for your SLD generation, the intended use (e.g. how you intend to apply the SLD), and anything else that might help us understand where you are going with this.
    – BradHards
    Oct 5, 2013 at 3:40
  • @BradHards It's okay to generate xml but I wanted to know if there are other ways like passing some parameter of size , column name and sld to be generated on the fly. Edited again.
    – kinkajou
    Oct 7, 2013 at 7:40

2 Answers 2


You can create SLD programmatically using the GeoTools SLD module. For more details work through the tutorial particularly the Creating styles By Hand section.


You can generate SLD from a StyleMap or a list of Styles in OpenLayers. Have a look at the write method in the OpenLayers.Format.SLD class. It says:

Write a SLD document given a list of styles.

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.