layergroups.rst 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. .. _rest_layergroups:
  2. Layer groups
  3. ============
  4. The REST API allows you to create and modify layer groups in GeoServer.
  5. .. note:: The examples below specify global layer groups, but the examples will work in a workspace-specific construction as well.
  6. .. note:: Read the :api:`API reference for /layergroups <layergroups.yaml>`.
  7. Creating a layer group
  8. ----------------------
  9. **Create a new layer group based on already-published layers**
  10. Given the following content saved as :file:`nycLayerGroup.xml`:
  11. .. code-block:: xml
  12. <layerGroup>
  13. <name>nyc</name>
  14. <layers>
  15. <layer>roads</layer>
  16. <layer>parks</layer>
  17. <layer>buildings</layer>
  18. </layers>
  19. <styles>
  20. <style>roads_style</style>
  21. <style>polygon</style>
  22. <style>polygon</style>
  23. </styles>
  24. </layerGroup>
  25. *Request*
  26. .. admonition:: curl
  27. ::
  28. curl -v -u admin:geoserver -XPOST -d @nycLayerGroup.xml -H "Content-type: text/xml"
  29. http://localhost:8080/geoserver/rest/layergroups
  30. *Response*
  31. ::
  32. 201 Created
  33. .. note::
  34. This layer group can be viewed with a WMS GetMap request::
  35. http://localhost:8080/geoserver/wms/reflect?layers=nyc