Geoportal SDK 2D/3D API Reference

Namespace: LayerOptions

Gp.LayerOptions

Layer options object.

Holds options for a specific layer present on the map. May be used at map creation (See layersOptions property of Gp.MapOptions object used as a parameter of Gp.Map.load() function) or for map modification (See Gp.Map.addLayers() or Gp.Map.modifyLayers()).

Given a specific layer type, availables options are the following :

Common properties

Common 2D/3D properties

property Type Description
format String The layer's format. Supported values are : 'kml', 'gpx', 'geojson', 'wmts', 'wms', 'wfs', 'mapbox' or 'osm'. This property is optionnal for Geoportal layers but mandatory for others.
url String Mandatory for non Geoportal layers, except if data option is set (at least one needs to be present) for the formats: KML, GeoJSON and GPX. The url to the file or the Web Service providing the layer.
title String The layer's name displayed in the LayerSwitcher control.
description String The layer's description.
opacity Float The layer's opacity (between 0 and 1). Default value is 1.
visibility Boolean If true, the layer is visible. Default value is true.
minZoom Integer If the current zoom level is lower than the minZoom of the layer, the layer is not displayed. Default value is given by the configuration service for Geoportal layers. For others layers, default value is the minZoom of the map.
maxZoom Integer If the current zoom level is upper than the maxZoom of the layer, the layer is not displayed. Default value is given by the configuration service for Geoportal layers. For others layers, default value is the maxZoom of the map.
position Number The layer's position in map, compared to other layers positions. Allows to organize layers order explicitely. By default the layer will be displayed above other layers.
legends Array[Gp.Config.Legend] The layer's legends links.

WMTS specific properties

Common 2D/3D properties

property Type Description
layer String The layer's Identifier to add (found in GetCapabilities response).
tileMatrixSet String The name of the layer's TileMatrixSet (see in GetCapabilities response).
topLeftCorner Gp.Point The layer's origin coordinates (found in GetCapabilities response).
resolutions Array[Float] The layer's resolutions list (found in GetCapabilities response).
matrixIds Array[String] The layer's zoom levels ids (found in GetCapabilities response).
outputFormat String The output image format (Mime-type)
styleName String The layer's style name to apply (found in GetCapabilities response).

Specific 2D properties

property Type Description
grayScaled Boolean If true, the layer is displayed in gray-scale.
queryable Boolean If true, user clicks on map will trigger getFeatureInfo request on the layer. Not yet implemented for WMTS.
gfiFormat String If queryable == true, indicates the format mime-type of the response of GetFeatureInfo requests. default : "text/html". Not yet implemented for WMTS.

Specific 3D properties

property Type Description
tileMatrixSetLimits Object Tiles limits of the tileMatrixSet used.
type String If "elevation", the layer is displayed as an elevation layer (DTM). Else, set "color"

KML specific properties

Common 2D/3D properties

property Type Description
extractStyles Boolean If true, the styles of the features are recovered from the kml file. True by default

Specific 2D properties

property Type Description
showPointNames Boolean If true, show names as labels for placemarks which contain points.
zoomToExtent Boolean If true, zoom into the extent of features.
projection String coordinate reference system id used for Layer (default is map projection)

MapBox specific properties

Common 2D/3D properties

property Type Description
url String The url to the style file of the layer (style.json)
styles Gp.MapboxStylesOptions options for layer styles
defaultStyleName String Name of the style by default of the layer
defaultStyleThumbnail String Thumbnail of the style by default of the layer
defaultStyleDescription String Description of the style by default of the layer
mapboxOptions Object -

Specific 2D properties

property Type Description
urlService String (Parameter not available, coming soon) overloads the url of the service of the requested mapbox layer
stylesSummary String styles description, can be displayed in the mapbox layer styles editor
filtersSummary String filters description, can be displayed in the mapbox layer filters editor
filters Gp.FiltersOptions options for layer filters
queryable Boolean If true, user clicks on map will trigger getFeatureInfo request on the layer
grayScaled Boolean If true, the layer is displayed in gray-scale.
zoomToExtent Boolean If true, zoom into the extent of features.

Event :

Name Attached on Description
render:success map Event triggered when the rendering of the style on the map layer was successful
render:failure map Event fired when style rendering on map layer fails

Example :

// listener
map.getLibMap().on("render:failure", function (evt) {
  console.error(evt);
  // object :
  // detail : { id, error, target }
});

map.getLibMap().on("render:success", function (evt) {
  console.info(evt);
  // object :
  // detail : { id, style, target }
 });

Specific 3D properties

property Type Description
showLabels Boolean True by default. If true, the labels associated to the mapbox layer will be displayed
sprite String Url to the sprites file. By default, automatically extracted from the style file.

KML, GPX, GeoJSON and MapBox specific properties

Common 2D/3D properties

property Type Description
data String Mandatory if url is not set (at least one needs to be present) for non Geoportal layers. The data of the file
styleOptions Gp.StyleOptions options for layer style (points, strokes, polygons)

WMS specific properties

Common 2D/3D properties

property Type Description
layers Array[String] layers List of layer's identifiers to add (found in GetCapabilities response).
version String The version of the Web Service providing the layer. Default : "1.3.0"
stylesNames Array[String] List of the styles names to apply to layers (see in GetCapabilities response).
outputFormat String The output image format (Mime-type)
projection String Coordinate reference system id used for Layer (default is map projection)

Specific 2D properties

property Type Description
grayScaled Boolean If true, the layer is displayed in gray-scale.
queryable Boolean If true, user clicks on map will trigger getFeatureInfo request on the layer.
gfiFormat String If queryable == true, indicates the format mime-type of the response of GetFeatureInfo requests. default : "text/html"
backgroundColor String The layer's background RVB color in hexadecimal.
tiled Boolean If true, map will load WMS layer in a tiled way. Otherwise, layer will be displayed with an unique GetMap request covering the whole map view (default).

Specific 3D properties

property Type Description
bbox Array[Float] Bounding box where to display the layer. The array must be "[west, south, east, north]". If the layer is in PM, the bbox needs to be in planar coordinates. World extent by default
type String If "elevation", the layer is displayed as an elevation layer (DTM)

Elevation Layers specific properties

To add a Digital Terrain Model Layer (DTM) in WMS or WMTS, the property "type" of the layerOptions must be set to "elevation"

property Type Description
type String If "elevation", the layer is displayed as an elevation layer (DTM) in 3D, and hidden in 2D (else, set "color")

WFS specific properties

Specific 2D properties

property Type Description
version String The version of the Web Service providing the layer. Default : "2.0.0"
typeNames String List of the features's name to add (see in GetCapabilities response).
outputFormat String The output format (Mime-type) to use for WFS requests (outputFormat parameter)
maxFeatures Integer Maximal number of features in the layer.
projection String Coordinate reference system id used for Layer (default is map projection)
TODO
  • finish description for tile vector layer (MapBox)