Book Image

GeoServer Cookbook

By : Stefano Iacovella
Book Image

GeoServer Cookbook

By: Stefano Iacovella

Overview of this book

Table of Contents (17 chapters)
GeoServer Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Managing layers with REST


In the previous recipe, you loaded a shapefile with REST. A data store and a layer were created and your data is now published on WMS. If you go to the layer preview page and select the ne_110m_coastline layer layer, you should see a map like this:

A style is applied to the data and all mandatory layer parameters were compiled by GeoServer when you issued the data store creation request.

While this is enough to get data properly configured on your server, in a real-world case your automation workflow should provide more control over data publication. The GeoServer REST interface gives you control over the layer item. In this recipe, you will see how to create a new layer and edit an existing one.

How to do it…

  1. Let's retrieve information from the ne_110m_coastline layer:

    $ curl -u admin:geoserver -XGET -H 'Accept: text/xml' http://localhost:8080/geoserver/rest/layers/ne_110m_coastline -o ne_110m_coastline.xml
    
  2. Now let's perform the same operation using Python:

    >&gt...