GeoserverConfig.FeatureTypes (GeoserverConfig v0.3.0)

Copy Markdown View Source

Provides functions to manage GeoServer feature types (vector layers) via its REST API.

Feature types are vector-based spatial resources that originate from datastores. This module handles listing, creating, updating, and deleting feature types.

Summary

Functions

create_featuretype(conn, workspace, datastore, featuretype_name, params \\ %{})

Creates a new feature type (vector layer) in the specified datastore.

Parameters

  • params: Map containing feature type configuration including:
    • title: Human-readable title
    • description: Description
    • abstract: Abstract text
    • srs: Coordinate reference system (e.g., "EPSG:4326")
    • native_crs: Native CRS
    • native_bbox: Native bounding box as %{minx: x, maxx: x, miny: y, maxy: y}
    • latlon_bbox: Lat/lon bounding box
    • enabled: Boolean (default: true)
    • keywords: List of keywords
    • metadata: Additional metadata

Returns

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

delete_featuretype(conn, workspace, datastore, featuretype_name, recurse \\ false)

Deletes a feature type from the given datastore.

Parameters

  • recurse: If true, also deletes dependent layers (default: false)

Returns

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

list_featuretypes(conn, workspace, datastore, list \\ :configured)

Lists all feature types in a given datastore and workspace.

Parameters

  • list: Optional parameter to filter results. Can be:
    • :configured - Only configured feature types (default)
    • :available - Only available but not configured feature types
    • :available_with_geom - Available feature types with geometry
    • :all - All feature types

Returns

  • {:ok, [feature_types]} on success
  • {:error, {:http_error, status, body}} on non-200 response
  • {:error, exception} on transport error

update_featuretype(conn, workspace, datastore, featuretype_name, params \\ %{}, recalculate \\ nil)

Updates an existing feature type.

Parameters

  • params: Map containing updated feature type properties
  • recalculate: Optional parameter to recalculate bounding boxes

Returns

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