Working with Layers
Once you are done with configuring styles, you probably want to apply them to layers. Creating or modifying styles is the last step for data publication. Unsurprisingly, it is possible to perform layer operations with the REST interface.
Managing Layers
In the previous section, you created a new style; however, it is useless if you cannot assign it to a layer. We will now update the populated place layer by adding the new style:
- Retrieve information on the
ne_50m_populated_places
layer:
$ curl -u admin:pwd -XGET -H 'Accept: text/xml'
http://localhost:8080/geoserver/rest/
layers/ne_50m_populated_places -o ne_50m_populated_places.xml
- In Python, use the following script:
import requests myUrl = 'http://localhost:8080/geoserver/rest/ layers/ne_50m_populated_places' headers = {'Accept: text/xml'} resp = requests.get(myUrl, auth=('admin','pwd'), headers=headers) if resp.status_code == 200: file = open('ne_50m_populated_places...