5

I'm working on my own geoportal. I have prepared a php page which users can describe their own SLD configuration. The SLD file will be stored in GeoServer style folder. But when I tried to view maps I couldn't see the changes on map. But if I go to the styles editor and click to the Submit button in my new SLD files, I can see the new SLD configuration on my map. I think Submit button is making some another configuration that ı don't know.

Are there any way refreshing the style edits?

4 Answers 4

6

I assume from your question that you are generating an SLD file and then copying it to the style directory in GeoServer.

As you have seen, that approach won't work because I believe the style also needs to be registered as a catalogue item in GeoServer - if you look in the style folder you will see companion XML files with the SLD files. The best way to add styles into GeoServer (aside from the web admin interface) is to use the REST API.

You just need to create your SLD file and then POST it to http://www.yourgeoserver.com/rest/styles. where format can be either json, XML, or HTML. You also need to specify a [name] parameter for the style which is what GeoServer will use to name the style.

I recommend you read the REST API documentation as it contains a lot of useful information that you could utilise in your portal.

Good luck!

2

There's GeoServer Manager, a REST client library to interact with GeoServer to help you with this.

1

As you have guessed there is some more configuration going on behind the scenes in GeoServer when a SLD file is added to the server. However the developers thought of this use case and provided a REST admin interface that you can use to upload data files that calls the right code to configure the new data.

You will particularly want this section which describes the settings you'll need to post a SLD file.

1

Make sure your sld is valid and did you associated your sld to the layer? If it is valid sld. You should check the layer editor and select style in the list to associate to layer.

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.