I have spent the complete day creating a single SLD file and tuning it, and I am on the one hand really pleased with the actual result, but really frustrated how cumbersome it is to edit and test SLD's using Geoserver web-interface.

In theory it is really simple: edit the SLD, "submit" and I scroll my layer-preview and see instant change.

But then my labels need to be shifted down a little, so I return to the styles view, search for my SLD, search the relevant label in my SLD (that tiny edit screen --what is it: 20 lines? is not really helping), save, and it starts all over again.

How do you edit/manage your SLD's?

For instance my particular SLD I created today has 1300 something lines, to describe 24 cases of drawing a point-symbolizer with a label, and to me this seems like a simple case.

I also have a lot of repetition for each rule, because the only thing that changes between the cases is the image I use, and the position of the label.

Are there any tools that help in editing/previewing SLD's? Can you actually edit the file directly? (damn, I did not try that, I assumed not because Geoserver needs to be "aware" it changed?).

Things I just thought of:

  • try to just edit the file in place using my favorite text-editor to see if that works
  • I just noticed that each SLD has a unique URL, that would save me the navigation to the SLD

As other said, look in GeoServer 2.10 announcement for a better editor workflow.

As for the repetition, you can probably get rid of some by using the transformation functions, but mind, legend generation won't work anymore if you use them: http://docs.geoserver.org/stable/en/user/styling/sld/tipstricks/transformation-func.html

If instead you have more complex cases you can look into alternative styling languages such CSS, where the repetition can be eliminated by using rule cascading and nesting: http://docs.geoserver.org/latest/en/user/styling/css/tutorial.html

  • Awwwwesome: the new editor indeed looks very cool! But the css! WOW! So readable and compact and cascading and nesting!! Thanks :) :) <3 <3 <3 – nathanvda Nov 17 '16 at 12:19

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.