Skip to contents

A lightweight helper function that queries the /collections endpoint of an OGC API using JSON. It verifies if a specified collection exists and provides a helpful error message with valid names if it does not.

Usage

check_ogc_collection(url, collection)

Arguments

url

A character string with the base URL of the OGC API.

collection

A character string with the ID of the collection to check.

Value

TRUE invisibly if the collection exists, otherwise throws an error.

Examples

 if (FALSE) { # \dontrun{
api_url <- "https://geo.api.vlaanderen.be/Wegenregister/ogc/features/v1"
check <- check_ogc_collection(api_url, "Wegsegment")
check

# An informative error is thrown when collection does not exist
check <- try(check_ogc_collection(api_url, "foutieve_laag"))
} # }