Adds a layer to a project: a new layer on a data source, a copy of a layer, or a reference to a layer of another project.
Required role: ORG_EDITOR, and the current user must have the MODIFY permission on the project and the VIEW permission on the data source.
New layer (no action)
action)| Field | Required | Description |
|---|---|---|
type | Yes | See the layer types below. |
spatialDataSourceId | Yes | The data source to display. It must match the type and its status must be READY. It can be a data source shared with your organization. |
name | Yes | Display name by locale. Must have a non-empty text in the project's default language. Only en, fr and es are kept; each text is limited to 2048 characters. |
description | No | Description by locale, same rules (not required). |
elementType | VECTOR, OGC_API_FEATURES | POINT, LINE, POLYGON or TEXT. TEXT needs the ANNOTATION_TEXT, ANNOTATION_ANGLE and ANNOTATION_HEIGHT attributes in the data source. |
layers, styles | WMS | Layer names and their style names from the service's capabilities, same number of each. |
layer, style | WMTS | Layer name (must exist in the capabilities) and style name. |
imageFormat | WMS, WMTS | Must be a format offered by the service (for example image/png). |
visible, listed, includeInLegend | No | Default true. |
minimumZoom, maximumZoom | No | From 0 to 23, default 0 and 23. The minimum must be lower than the maximum. |
selectable | No | Default false. |
allowClientSideEditing | No | VECTOR. Default false. |
generalizationLevel | No | VECTOR. HIGH (default), MEDIUM or LOW. |
baseFilter | No | VECTOR. A CQL2-JSON filter applied to the data source, checked against the data. |
attributes | No | Display settings of the data source attributes (name, visible, title). The layer always gets all the attributes of the data source; this only changes the ones you list. Each name must exist in the data source. A title changes the data source attribute's title, for every layer that uses it. |
rotationAttribute, rotationDirection | No | POINT layers. A numeric attribute used to rotate the symbols, and CW (default) or CCW. |
selectionStyleId | No | A style of your organization to show selected features, compatible with elementType. By default, one is created from the project's selection color. |
mouseOverConfiguration | No | Content shown when hovering a feature. For WMS and WMTS, the GetFeatureInfo URL is set automatically. |
labellingConfiguration | No | Labels of the features. |
tags | No | Tag names to add to the layer. |
The new layer is added at the bottom of the project's layer tree, with a default style and a default style rule. Every principal with a permission on the project gets VIEW and the extract permission on the data source, inherited from the project.
Copy of a layer ("action": "clone")
"action": "clone")Send action, projectId and layerId (the layer to copy, in a project of your organization where you have VIEW). The copy has the same data source, configuration (including includeInLegend), attributes settings, style rules, dynamic filters, report assignments and tags. Only name is used from the body (merged over the copied name); the other fields are ignored. The source can be in the same project, but can't be a reference.
Reference to a layer ("action": "reference")
"action": "reference")Send action, projectId and layerId (a layer of another project of your organization, where you have VIEW), and optionally name (default: the source's name; when sent, same rules as for a new layer) and tags. The reference shows the source's data and style, and follows its changes. It can't reference a reference. Deleting the source layer deletes its references.
Response
201 with the id of the new layer in result. Its URL is also in the Location header.
Layer types
type | Data source | Specific fields |
|---|---|---|
VECTOR | file, vector, custom_view | elementType, attributes, selectable, allowClientSideEditing, generalizationLevel, baseFilter, rotationAttribute, rotationDirection, selectionStyleId, mouseOverConfiguration, labellingConfiguration |
OGC_API_FEATURES | apifeature | The same as VECTOR, except allowClientSideEditing, generalizationLevel and baseFilter |
RASTER | raster | None |
WMS | wmswmts | layers, styles, imageFormat, mouseOverConfiguration |
WMTS | wmswmts | layer, style, imageFormat, mouseOverConfiguration |
type is case-insensitive. Fields that don't apply to the type are ignored. RASTER, WMS and WMTS layers have the elementType IMAGE.
A layer can also reference a layer of another project (type REFERENCED in the responses): it shows the same data and style, and only has its own name, description, visibility, legend and zoom settings. See action below.
Organization
organization must be the organization of the access token, and the project must belong to it; otherwise the request returns 404.
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||