Publishing maps to OGC API - Maps
OGC API - Maps provides geospatial data as web maps.
To add data to pygeoapi, you can use the dataset example in Configuration as a baseline and modify accordingly.
Providers
pygeoapi core feature providers are listed below, along with a matrix of supported query parameters.
Provider |
bbox |
width/height |
crs |
bbox-crs |
|---|---|---|---|---|
✅ |
✅ |
✅ |
✅ |
|
✅ |
✅ |
✅ |
✅ |
Below are specific connection examples based on supported providers.
Connection examples
MapScript
MapScript (see website) is MapServer’s scripting interface to map rendering.
To publish a map via MapScript, the path to data is required, as well as the layer type (options.type). To style the data, set options.style. If no style is specified, the layer will be rendered with defaults.
MapServer layer types (options.type):
MS_LAYER_POINT
MS_LAYER_LINE
MS_LAYER_POLYGON
MS_LAYER_RASTER
Currently supported style files (options.style):
OGC Styled Layer Descriptor (SLD)
MapServer CLASS includes (i.e. file snippets with CLASS definitions)
providers:
- type: map
name: MapScript
data: /path/to/data.shp
options:
type: MS_LAYER_POINT
layer: foo_name
style: ./foo.sld
format:
name: png
mimetype: image/png
storage_crs: http://www.opengis.net/def/crs/EPSG/0/4326
Projections are supported through EPSG codes (options.projection):
options:
type: MS_LAYER_POINT
layer: foo_name
projection: 32631
This parameter is optional, defaulting to WGS84 (4236).
This provider also supports tile indexing, which lets MapScript create a mosaic on the fly, piecing together a set of files. In order to enable it, set options.tileindex to True and set the location of the index file on the data path.
providers:
- type: map
name: MapScript
data: /data/index.shp
options:
type: MS_LAYER_RASTER
tileindex: True
layer: index
format:
name: png
mimetype: image/png
storage_crs: http://www.opengis.net/def/crs/EPSG/0/4326
The options.tileindex parameter is optional, defaulting to False.
WMSFacade
To publish a WMS via pygeoapi, the WMS base URL (data) and layer name (options.layer) is required. An optional style name can be defined via options.style.
providers:
- type: map
name: WMSFacade
data: https://demo.mapserver.org/cgi-bin/msautotest
options:
layer: world_latlong
style: default
version: 1.3.0
format:
name: png
mimetype: image/png
storage_crs: http://www.opengis.net/def/crs/EPSG/0/4326
Note
According to the Standard, OGC API - Maps supports a crs parameter, expressed as an uri. Currently, this provider supports CRS84, WGS84 and Web Mercator; for a matter of convenience, they can be expressed in a number of different ways, other than the uri format.
EPSG:4326
EPSG:3857
4326
3857,
CRS84
If crs is not provided, the server will default to the storage_crs; in case it does not exist, the default is CRS84. If crs-bbox is not provided, it will default to CRS84. If the bbox is not provided, it will default to -180, -90, 180, 90.
The response headers will always contain the Content-Crs and Content-Bbox. Examples:
Content-Bbox: -180.0,-90.0,180.0,90.0
Content-Crs: http://www.opengis.net/def/crs/EPSG/0/4326
Data visualization examples
list all collections
overview of dataset
map (default format)
map with bbox subset
map with bbox and temporal subset
map with bbox and bbox-crs
map with vertical subset (
extents.verticalmust be set in resource level config)