2

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
6
  • did you try version 2.10.0?
    – Ian Turton
    Commented Nov 16, 2016 at 20:59
  • I suppose that QGIS has some plugin for that purpose.
    – user30184
    Commented Nov 16, 2016 at 21:40
  • 1
    Read the blog blog.geoserver.org/2016/10/31/geoserver-2-10-0-released which mentions the new style editor.
    – user30184
    Commented Nov 17, 2016 at 7:11
  • 1
    Btw, just editing in place won't work, GeoServer will not notice you changed the file, you still have to go into the GeoServer GUI and hit the "clear" button in the status page to force it to reload the style from disk. Commented Nov 17, 2016 at 9:47
  • 1
    Ah, also see the blog dedicated to the new style editor: blog.geoserver.org/2016/11/14/… Commented Nov 17, 2016 at 9:52

1 Answer 1

2

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

1
  • 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
    Commented Nov 17, 2016 at 12:19

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.