1

On the GeoServer admin page, it is possible to restrict the Spatial Reference Systems (SRS) that can be requested in WMS GetMap requests by putting a comma separated list of SRS numbers in the input box at http://localhost:8080/geoserver/web/?wicket:bookmarkablePage=:org.geoserver.wms.web.WMSAdminPage (set server and port according to your server).

In consequence, only the specified SRS numbers can be used for the SRS parameter in GetMap requests (all others will not get a valid response). Besides, limiting GeoServer to only a few SRS that are really needed by your application will shorten the GetCapabilities document significantly because a very long list of all available SRS is included by default when there is no limit set.

Is there any possibility to set this limit via GeoServer's REST Api? Unfortunately, I could not find any example on this in the documentation.

2

One excellent feature in REST is that you can read a configuration document with correct syntax from a running service with REST and just edit it and then PUT it back. However, with the limited SRS list there is a problem because if it is not set it is not included in the document either. Therefore I recommend to set a limited SRS list first manually with the admin utility and to read WMS settings from REST after that:

http://localhost:8080/geoserver/rest/services/wms/settings.json

You will see that the limited SRS list looks like "srs":{"string":[4326,3857]} as json and as XML

<srs>
<string>4326</string>
<string>3857</string>
</srs>

Now all you need to do is to edit the json, or XML if you prefer, and PUT it back. You can use cUrl or for example Poster as here (notice the Content Type)

enter image description here

If PUT is successful you will get http 200 back and you've done it

enter image description here

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.