GeoserverConfig.LayerGroups (GeoserverConfig v0.3.0)

Copy Markdown View Source

Provides functionality to manage Layer Groups in GeoServer via the REST API.

All functions require a GeoserverConfig.Connection as their first argument.

Summary

Functions

Adds a layer with an optional style to a GeoServer layer group.

Creates a new layer group in GeoServer.

Deletes a layer group from GeoServer by name.

Lists all layer groups available in GeoServer.

Removes a layer from a GeoServer layer group.

Updates an existing layer group.

Functions

add_layer_to_group(conn, group_name, layer_name, style_name \\ nil)

Adds a layer with an optional style to a GeoServer layer group.

Fetches the current group state and appends the new layer before updating.

Returns

  • {:ok, body} on success
  • {:error, reason} on failure

create_layer_group(conn, body)

Creates a new layer group in GeoServer.

Accepts either an XML string or a JSON map as the body.

Returns

  • {:ok, body} on success (2xx)
  • {:error, {:http_error, status, body}} on failure
  • {:error, {:request_failed, reason}} on transport error

delete_layer_group(conn, name)

Deletes a layer group from GeoServer by name.

Returns

  • {:ok, name} on success
  • {:error, {:http_error, status, body}} on failure
  • {:error, {:request_failed, reason}} on transport error

list_layer_groups(conn)

Lists all layer groups available in GeoServer.

Returns

  • {:ok, [group]} on success
  • {:error, {:http_error, status, body}} on non-200 response
  • {:error, {:request_failed, reason}} on transport error

remove_layer_from_group(conn, group_name, layer_name)

Removes a layer from a GeoServer layer group.

Fetches the current group state and filters out the named layer before updating.

Returns

  • {:ok, body} on success
  • {:error, :layer_not_found} if the layer is not in the group
  • {:error, reason} on other failure

update_layer_group(conn, name, body)

Updates an existing layer group.

Accepts either an XML string or a JSON map as the body.

Returns

  • {:ok, body} on success
  • {:error, {:http_error, status, body}} on failure
  • {:error, {:request_failed, reason}} on transport error