Skip to main content

CSWService 🚧



The CSWService class provides OGC CSW (catalog service for the web) access

  • Type safe methods to call and parse results (and errors) from a CSW service's endpoints
  • In particular, the big GetCapabilities metadata is normalized into a fully typed data structure.

The CSWService generates URLs with URL parameters intended to be used with HTTP GET requests against a CSW server. The OGC CSW standard also allows CSW services to accept XML payloads with HTTP POST messages, however generation of such XML payloads is not supported by this class.


A CSWService instance provides type safe methods that make calls to the service and parse the responses.

Get a normalized array of all the services and resources referenced by this catalog server:

  const cswService = new CSWService({url: CSW_SERVICE_URL});
const serviceDirectory = await cswService.getServiceDirectory({includeUnknown: true});

Capabilities metadata can be queried:

  const cswService = new CSWService({url: CSW_SERVICE_URL});
const capabilities = await cswService.getCapabilities({});
// Check capabilities

Custom fetch options, such as HTTP headers, and loader-specific options can be specified via the standard loadOptions argument, which is forwarded to all load and parse operations:

  const cswService = new CSWService({url: CSW_SERVICE_URL, loadOptions: {
fetch: {
headers: {
Authentication: 'Bearer abc...'

const serviceDirectory = await cswService.getServiceDirectory();



Creates a CSWService instance

export type CSWServiceProps = {
url: string; // Base URL to the service
loadOptions?: LoaderOptions; // Passed to loaders used by CSWService methods

constructor(props: CSWServiceProps)


Get Capabilities

async getCapabilities(
cswParameters?: CSWGetCapabilitiesParameters,
vendorParameters?: Record<string, unknown>
): Promise<CSWCapabilities>


Get a list of all service exposed by this catalog server.

async getServiceDirectory(
options: CSWGetMapParameters,
vendorParameters?: Record<string, unknown>
): Promise<Service[]>
export type CSWGetMapParameters = {
includeUnknown: boolean; // Include services and resources that cannot handle