Skip to contents

Registers a PostGIS database as a `datastore` in a specified GeoServer workspace.

Usage

register_datastore_postgis(
  gso,
  datastore,
  db_name,
  host,
  port,
  db_user,
  db_password,
  schema
)

# S3 method for class 'geoserver'
register_datastore_postgis(
  gso,
  datastore,
  db_name,
  host,
  port = 5432,
  db_user,
  db_password,
  schema = "public"
)

Arguments

gso

An object of class `geoserver` containing GeoServer connection details.

datastore

A character string. The name of the datastore to be created.

db_name

A character string. The name of the PostGIS database.

host

A character string. The database host.

port

An integer. The database port (default: 5432).

db_user

A character string. The database username.

db_password

A character string. The database password.

schema

A character string. The database schema (default: "public").

Value

An object of class `geoserver` or NULL if an error occurred.

Details

If the `datastore` has already been registered previously, there is no need to specify the database connection. For subsequent operations, that `datastore` will be used.

In any case, prints an appropriate message.

See also

Other publish to GeoServer: geoserver(), publish_bands(), publish_layer(), publish_layer_set(), publish_raster()

Examples

if (FALSE) { # \dontrun{
gso <- geoserver(
  url = "http://localhost:8080/geoserver",
  user = "admin",
  password = "geoserver",
  workspace = "sigugr_test"
)

gso <- gso |>
  register_datastore_postgis(
    "sigugr-postgis",
    db_name = 'sigugr_example',
    host = 'localhost',
    port = 5432,
    db_user = 'user',
    db_password = 'password',
    schema = "public"
  )
} # }