# CSW - OGC CSW (Catalog Service for the Web)

Driver short name

CSW

Build dependencies

libcurl

This driver can connect to a OGC CSW service. It supports CSW 2.0.2 protocol. GDAL/OGR must be built with Curl support in order to the CSW driver to be compiled. And the GML driver should be set-up for read support (thus requiring GDAL/OGR to be built with Xerces or Expat support).

It retrieves records with Dublin Core metadata.

## Driver capabilities

Supports Georeferencing

This driver supports georeferencing

## Dataset name syntax

The minimal syntax to open a CSW datasource is : CSW: and the URL open option, or CSW:http://path/to/CSW/endpoint

## Filtering

The driver will forward any spatial filter set with SetSpatialFilter() to the server. It also makes its best effort to do the same for attribute filters set with SetAttributeFilter() when possible (turning OGR SQL language into OGC filter description).

The anytext field can be queried to do a search in any text field. Note that we always return it as null content however in OGR side, to avoid duplicating information.

## Issues

Some servers do not respect EPSG axis order, in particular latitude, longitude order for WGS 84 geodetic coordinates, so it might be needed to specify the `GML_INVERT_AXIS_ORDER_IF_LAT_LONG=NO` configuration option in those cases.

## Open options

Open options can be specified in command-line tools using the syntax `-oo <NAME>=<VALUE>` or by providing the appropriate arguments to `GDALOpenEx()` (C) or `gdal.OpenEx` (Python). The following open options are supported:

- URL=value: URL to the CSW server endpoint (if not specified in the connection string already)

- ELEMENTSETNAME=[brief​/​summary​/​full]: Defaults to `full`. Level of details of properties.

- FULL_EXTENT_RECORDS_AS_NON_SPATIAL=[YES​/​NO]: Defaults to `NO`. Whether records with (-180,-90,180,90) extent should be considered non-spatial.

- OUTPUT_SCHEMA=value: Value of outputSchema parameter, in the restricted set supported by the serve. Special value gmd can be used as a shortcut for http://www.isotc211.org/2005/gmd, csw for http://www.opengis.net/cat/csw/2.0.2. When this open option is set, a raw_xml field will be filled with the XML content of each record. Other metadata fields will remain empty.

- MAX_RECORDS=value: Defaults to `500`. Maximum number of records to retrieve in a single time. Servers might have a lower accepted value.

## Configuration options

Configuration options can be specified in command-line tools using the syntax `--config <NAME>=<VALUE>` or using functions such as `CPLSetConfigOption()` (C) or `gdal.config_options` (Python). The following configuration options are available:

- GML_INVERT_AXIS_ORDER_IF_LAT_LONG=[YES​/​NO]: See CRS support. Equivalent of `INVERT_AXIS_ORDER_IF_LAT_LONG` open option.

## Examples

Listing all the records of a CSW server:

    ogrinfo -ro -al -noextent CSW:http://catalog.data.gov/csw

Listing all the records of a CSW server with spatial and an attribute filter on a give field:

    ogrinfo -ro -al -noextent CSW:http://catalog.data.gov/csw -spat 2 49 2 49 -where "subject LIKE '%mineralogy%'"

Listing all the records of a CSW server that matches a text on any text field:

    ogrinfo -ro -al -q CSW:http://catalog.data.gov/csw -spat 2 49 2 49 -where "anytext LIKE '%France%'"

Listing all the records of a CSW server as ISO 19115/19119:

    ogrinfo -ro -al -q CSW:http://catalog.data.gov/csw -oo OUTPUT_SCHEMA=gmd

## See Also

- OGC CSW Standard

- GML driver documentation