I am using a c# application that creates and update
featuretypes in Geoserver via REST. I need to set the declared srs, but I couldn't find how to do so.
Setting the declared SRS is relatively straight forward using the GeoServer REST API. The key to using the REST API is to understand that you only need to send fragments when updating an existing resource, I have seen others in the past trying to build a complete resource XML to
PUT and then coming unstuck.
To set the declared SRS you need to set two components on the
- The SRS to use
- The projection policy
This can be sent as an XML fragment, for example:
<featureType> <srs>EPSG:3857</srs> <projectionPolicy>FORCE_DECLARED</projectionPolicy> </featureType>
In the above example Spherical Web Mercator is being set as the SRS and then the FORCE_DECLARED projection policy is being set. Sending this small fragment to the appropriate resource will set the declared srs.
If you are updating an existing
featuretype then you will need to send the XML fragment using PUT and if you are setting it when you are creating the
featuretype then you just need to make sure you include the
projectionPolicy elements within your XML representing the