Add a layer to a project

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)

FieldRequiredDescription
typeYesSee the layer types below.
spatialDataSourceIdYesThe 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.
nameYesDisplay 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.
descriptionNoDescription by locale, same rules (not required).
elementTypeVECTOR, OGC_API_FEATURESPOINT, LINE, POLYGON or TEXT. TEXT needs the ANNOTATION_TEXT, ANNOTATION_ANGLE and ANNOTATION_HEIGHT attributes in the data source.
layers, stylesWMSLayer names and their style names from the service's capabilities, same number of each.
layer, styleWMTSLayer name (must exist in the capabilities) and style name.
imageFormatWMS, WMTSMust be a format offered by the service (for example image/png).
visible, listed, includeInLegendNoDefault true.
minimumZoom, maximumZoomNoFrom 0 to 23, default 0 and 23. The minimum must be lower than the maximum.
selectableNoDefault false.
allowClientSideEditingNoVECTOR. Default false.
generalizationLevelNoVECTOR. HIGH (default), MEDIUM or LOW.
baseFilterNoVECTOR. A CQL2-JSON filter applied to the data source, checked against the data.
attributesNoDisplay 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, rotationDirectionNoPOINT layers. A numeric attribute used to rotate the symbols, and CW (default) or CCW.
selectionStyleIdNoA style of your organization to show selected features, compatible with elementType. By default, one is created from the project's selection color.
mouseOverConfigurationNoContent shown when hovering a feature. For WMS and WMTS, the GetFeatureInfo URL is set automatically.
labellingConfigurationNoLabels of the features.
tagsNoTag 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")

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")

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

typeData sourceSpecific fields
VECTORfile, vector, custom_viewelementType, attributes, selectable, allowClientSideEditing, generalizationLevel, baseFilter, rotationAttribute, rotationDirection, selectionStyleId, mouseOverConfiguration, labellingConfiguration
OGC_API_FEATURESapifeatureThe same as VECTOR, except allowClientSideEditing, generalizationLevel and baseFilter
RASTERrasterNone
WMSwmswmtslayers, styles, imageFormat, mouseOverConfiguration
WMTSwmswmtslayer, 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.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Path Params
uuid
required

Id of your organization (must match the access token)

uuid
required

Id of the project

Body Params

Layer to create. The fields depend on type; to copy or reference a layer, send action, projectId and layerId.

string

Can be clone, reference or unspecified. If clone or reference, projectId and layerId are required.

boolean

Applies to types VECTOR

attributes
array of objects

Applies to types VECTOR and OGC_API_FEATURES

attributes
baseFilter
object

Applies to types VECTOR

description
object

Key is a locale (en, fr or es)

string
enum

Applies to types VECTOR and OGC_API_FEATURES – required

Allowed:
string
enum

Applies to types VECTOR

Allowed:
string

Applies to types WMS and WMTS – required

boolean
labellingConfiguration
object

Applies to types VECTOR and OGC_API_FEATURES

string

Applies to type WMTS – required – The layer name from the GetCapabilities

string

Applies if action is clone or reference. The ID of the layer to clone or reference.

layers
array of strings

Applies to type WMS – required – The layer name(s) from the GetCapabilities

layers
boolean
float
0 to 23
float
0 to 23
mouseOverConfiguration
object

Applies to types VECTOR, WMS, WMTS and OGC_API_FEATURES

name
object

Key is a locale (en, fr or es)

string

Applies if action is clone or reference. The ID of the project containing the layer to clone or reference.

string

Applies to types VECTOR and OGC_API_FEATURES – The name of the attribute to use for symbol rotation. The attribute must be of numeric type and exist in the specified attributes.

string
enum

Applies to types VECTOR and OGC_API_FEATURES

Allowed:
boolean

Applies to types VECTOR and OGC_API_FEATURES

string

Applies to types VECTOR and OGC_API_FEATURES – The ID of the style to use for feature selection. The style must exist in the project styles and be compatible with the layer element type. A default style will be created if not specified.

uuid
string

Applies to type WMTS – required – The style name from the GetCapabilities of the specified layer

styles
array of strings

Applies to type WMS – required – The style name(s) from the GetCapabilities of the specified layers

styles
tags
array of strings
tags
string
enum
Allowed:
boolean
Responses

Language
Credentials
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json