@ignf-geoportal/sdk-2d
Version:
French Geoportal SDK based on OpenLayers (2D)
1,676 lines (1,667 loc) • 8.11 MB
JavaScript
/*!
* @brief French Geoportal SDK based on OpenLayers (2D) and iTowns (3D) libraries
*
* This software is released under the licence CeCILL-B (Free BSD compatible)
* @see http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt
* @see http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.txt
* @see http://www.cecill.info/
*
* @copyright copyright (c) IGN
* @license CeCILL-B
* @author IGN
* @version 3.5.6
* @date 12/06/2025
* @build
* date : 6/12/2025, 9:13:19 AM
* branch : tags/3.5.6
* commit : 8e7596e
* dirty : true
*/
/*!
* geoportal-extensions-openlayers. See https://github.com/IGNF/geoportal-extensions
* @license https://github.com/IGNF/geoportal-extensions/blob/master/LICENCE.md
* @version 3.4.6
*/
/*!
* @overview ol-mapbox-style - Use Mapbox Style objects with OpenLayers
* @copyright Copyright (c) 2016 openlayers
* @license BSD 2-Clause "Simplified" License
* See https://raw.githubusercontent.com/openlayers/ol-mapbox-style/master/LICENSE
* @version 6.7.0
*/
/*!
* @overview OpenLayers. See http://openlayers.org/
* @copyright Copyright 2005-present, OpenLayers Contributors All rights reserved.
* @license BSD 2-Clause "Simplified" License
* See https://raw.githubusercontent.com/openlayers/openlayers/master/LICENCE.md
* @version 6.9.0
*/
/*!
* Sortable -- JavaScript library for reorderable drag-and-drop lists on modern
* browsers and touch devices. No jQuery required. Supports Meteor, AngularJS,
* React, Polymer, Vue, Knockout and any CSS library, e.g. Bootstrap.
*
* Released under MIT LICENSE
*
* Copyright Lebedev Konstantin <ibnRubaXa@gmail.com>
* https://github.com/SortableJS/Sortable
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* @version v1.8.4
*/
/*!
* @overview es6-promise - a tiny implementation of Promises/A+.
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
* @license Licensed under MIT license
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
* @version v4.2.4
*/
/*!
* @overview Proj4js - Javascript reprojection library.
*
* @authors
* - Mike Adair madairATdmsolutions.ca
* - Richard Greenwood richATgreenwoodmap.com
* - Didier Richard didier.richardATign.fr
* - Stephen Irons stephen.ironsATclear.net.nz
* - Olivier Terral oterralATgmail.com
* - Calvin Metcalf cmetcalfATappgeo.com
*
* @copyright Copyright (c) 2014, Mike Adair, Richard Greenwood, Didier Richard, Stephen Irons, Olivier Terral and Calvin Metcalf
* @license Licensed under MIT license
* See https://raw.githubusercontent.com/proj4js/proj4js/master/LICENSE.md
* @version 2.7.5
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("node-fetch"));
else if(typeof define === 'function' && define.amd)
define("Gp", ["require"], factory);
else if(typeof exports === 'object')
exports["Gp"] = factory(require("node-fetch"));
else
root["Gp"] = factory(root[undefined]);
})(window, function(__WEBPACK_EXTERNAL_MODULE_node_fetch__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // install a JSONP callback for chunk loading
/******/ function webpackJsonpCallback(data) {
/******/ var chunkIds = data[0];
/******/ var moreModules = data[1];
/******/
/******/
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
/******/ var moduleId, chunkId, i = 0, resolves = [];
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {
/******/ resolves.push(installedChunks[chunkId][0]);
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
/******/ for(moduleId in moreModules) {
/******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {
/******/ modules[moduleId] = moreModules[moduleId];
/******/ }
/******/ }
/******/ if(parentJsonpFunction) parentJsonpFunction(data);
/******/
/******/ while(resolves.length) {
/******/ resolves.shift()();
/******/ }
/******/
/******/ };
/******/
/******/
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
/******/ // Promise = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ 0: 0
/******/ };
/******/
/******/
/******/
/******/ // script path function
/******/ function jsonpScriptSrc(chunkId) {
/******/ return __webpack_require__.p + "" + ({"1":"chunk-geotiff"}[chunkId]||chunkId) + "-src.js"
/******/ }
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/ // This file contains only the entry chunk.
/******/ // The chunk loading function for additional chunks
/******/ __webpack_require__.e = function requireEnsure(chunkId) {
/******/ var promises = [];
/******/
/******/
/******/ // JSONP chunk loading for javascript
/******/
/******/ var installedChunkData = installedChunks[chunkId];
/******/ if(installedChunkData !== 0) { // 0 means "already installed".
/******/
/******/ // a Promise means "currently loading".
/******/ if(installedChunkData) {
/******/ promises.push(installedChunkData[2]);
/******/ } else {
/******/ // setup Promise in chunk cache
/******/ var promise = new Promise(function(resolve, reject) {
/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject];
/******/ });
/******/ promises.push(installedChunkData[2] = promise);
/******/
/******/ // start chunk loading
/******/ var script = document.createElement('script');
/******/ var onScriptComplete;
/******/
/******/ script.charset = 'utf-8';
/******/ script.timeout = 120;
/******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ }
/******/ script.src = jsonpScriptSrc(chunkId);
/******/
/******/ // create error before stack unwound to get useful stacktrace later
/******/ var error = new Error();
/******/ onScriptComplete = function (event) {
/******/ // avoid mem leaks in IE.
/******/ script.onerror = script.onload = null;
/******/ clearTimeout(timeout);
/******/ var chunk = installedChunks[chunkId];
/******/ if(chunk !== 0) {
/******/ if(chunk) {
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
/******/ var realSrc = event && event.target && event.target.src;
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
/******/ error.name = 'ChunkLoadError';
/******/ error.type = errorType;
/******/ error.request = realSrc;
/******/ chunk[1](error);
/******/ }
/******/ installedChunks[chunkId] = undefined;
/******/ }
/******/ };
/******/ var timeout = setTimeout(function(){
/******/ onScriptComplete({ type: 'timeout', target: script });
/******/ }, 120000);
/******/ script.onerror = script.onload = onScriptComplete;
/******/ document.head.appendChild(script);
/******/ }
/******/ }
/******/ return Promise.all(promises);
/******/ };
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // on error function for async loading
/******/ __webpack_require__.oe = function(err) { console.error(err); throw err; };
/******/
/******/ var jsonpArray = window["webpackJsonpGp"] = window["webpackJsonpGp"] || [];
/******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray);
/******/ jsonpArray.push = webpackJsonpCallback;
/******/ jsonpArray = jsonpArray.slice();
/******/ for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);
/******/ var parentJsonpFunction = oldJsonpFunction;
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ({
/***/ "./node_modules/@mapbox/mapbox-gl-style-spec/dist/index.es.js":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* WEBPACK VAR INJECTION */(function(global, Buffer) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Color", function() { return Color; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParsingError", function() { return ParsingError$1; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ValidationError", function() { return ValidationError; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "composite", function() { return composite; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertFilter", function() { return convertFilter$1; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "derefLayers", function() { return derefLayers; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "diff", function() { return diffStyles; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "expression", function() { return expression$1; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "featureFilter", function() { return createFilter; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "format", function() { return format; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "function", function() { return styleFunction; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "latest", function() { return v8; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "migrate", function() { return migrate; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v8", function() { return v8; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "validate", function() { return validateStyle; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "validateMapboxApiSupported", function() { return validateMapboxApiSupported; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "visit", function() { return visit; });
var $version = 8;
var $root = {
version: {
required: true,
type: "enum",
values: [
8
],
doc: "Style specification version number. Must be 8.",
example: 8
},
name: {
type: "string",
doc: "A human-readable name for the style.",
example: "Bright"
},
metadata: {
type: "*",
doc: "Arbitrary properties useful to track with the stylesheet, but do not influence rendering. Properties should be prefixed to avoid collisions, like 'mapbox:'."
},
center: {
type: "array",
value: "number",
doc: "Default map center in longitude and latitude. The style center will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",
example: [
-73.9749,
40.7736
]
},
zoom: {
type: "number",
doc: "Default zoom level. The style zoom will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",
example: 12.5
},
bearing: {
type: "number",
"default": 0,
period: 360,
units: "degrees",
doc: "Default bearing, in degrees. The bearing is the compass direction that is \"up\"; for example, a bearing of 90° orients the map so that east is up. This value will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",
example: 29
},
pitch: {
type: "number",
"default": 0,
units: "degrees",
doc: "Default pitch, in degrees. Zero is perpendicular to the surface, for a look straight down at the map, while a greater value like 60 looks ahead towards the horizon. The style pitch will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",
example: 50
},
light: {
type: "light",
doc: "The global light source.",
example: {
anchor: "viewport",
color: "white",
intensity: 0.4
}
},
terrain: {
type: "terrain",
doc: "A global modifier that elevates layers and markers based on a DEM data source."
},
fog: {
type: "fog",
doc: "A global effect that fades layers and markers based on their distance to the camera. The fog can be used to approximate the effect of atmosphere on distant objects and enhance the depth perception of the map when used with terrain or 3D features."
},
sources: {
required: true,
type: "sources",
doc: "Data source specifications.",
example: {
"mapbox-streets": {
type: "vector",
url: "mapbox://mapbox.mapbox-streets-v6"
}
}
},
sprite: {
type: "string",
doc: "A base URL for retrieving the sprite image and metadata. The extensions `.png`, `.json` and scale factor `@2x.png` will be automatically appended. This property is required if any layer uses the `background-pattern`, `fill-pattern`, `line-pattern`, `fill-extrusion-pattern`, or `icon-image` properties. The URL must be absolute, containing the [scheme, authority and path components](https://en.wikipedia.org/wiki/URL#Syntax).",
example: "mapbox://sprites/mapbox/bright-v8"
},
glyphs: {
type: "string",
doc: "A URL template for loading signed-distance-field glyph sets in PBF format. The URL must include `{fontstack}` and `{range}` tokens. This property is required if any layer uses the `text-field` layout property. The URL must be absolute, containing the [scheme, authority and path components](https://en.wikipedia.org/wiki/URL#Syntax).",
example: "mapbox://fonts/mapbox/{fontstack}/{range}.pbf"
},
transition: {
type: "transition",
doc: "A global transition definition to use as a default across properties, to be used for timing transitions between one value and the next when no property-specific transition is set. Collision-based symbol fading is controlled independently of the style's `transition` property.",
example: {
duration: 300,
delay: 0
}
},
layers: {
required: true,
type: "array",
value: "layer",
doc: "Layers will be drawn in the order of this array.",
example: [
{
id: "water",
source: "mapbox-streets",
"source-layer": "water",
type: "fill",
paint: {
"fill-color": "#00ffff"
}
}
]
}
};
var sources = {
"*": {
type: "source",
doc: "Specification of a data source. For vector and raster sources, either TileJSON or a URL to a TileJSON must be provided. For image and video sources, a URL must be provided. For GeoJSON sources, a URL or inline GeoJSON must be provided."
}
};
var source = [
"source_vector",
"source_raster",
"source_raster_dem",
"source_geojson",
"source_video",
"source_image"
];
var source_vector = {
type: {
required: true,
type: "enum",
values: {
vector: {
doc: "A vector tile source."
}
},
doc: "The type of the source."
},
url: {
type: "string",
doc: "A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<Tileset ID>`."
},
tiles: {
type: "array",
value: "string",
doc: "An array of one or more tile source URLs, as in the TileJSON spec."
},
bounds: {
type: "array",
value: "number",
length: 4,
"default": [
-180,
-85.051129,
180,
85.051129
],
doc: "An array containing the longitude and latitude of the southwest and northeast corners of the source's bounding box in the following order: `[sw.lng, sw.lat, ne.lng, ne.lat]`. When this property is included in a source, no tiles outside of the given bounds are requested by Mapbox GL."
},
scheme: {
type: "enum",
values: {
xyz: {
doc: "Slippy map tilenames scheme."
},
tms: {
doc: "OSGeo spec scheme."
}
},
"default": "xyz",
doc: "Influences the y direction of the tile coordinates. The global-mercator (aka Spherical Mercator) profile is assumed."
},
minzoom: {
type: "number",
"default": 0,
doc: "Minimum zoom level for which tiles are available, as in the TileJSON spec."
},
maxzoom: {
type: "number",
"default": 22,
doc: "Maximum zoom level for which tiles are available, as in the TileJSON spec. Data from tiles at the maxzoom are used when displaying the map at higher zoom levels."
},
attribution: {
type: "string",
doc: "Contains an attribution to be displayed when the map is shown to a user."
},
promoteId: {
type: "promoteId",
doc: "A property to use as a feature id (for feature state). Either a property name, or an object of the form `{<sourceLayer>: <propertyName>}`. If specified as a string for a vector tile source, the same property is used across all its source layers."
},
volatile: {
type: "boolean",
"default": false,
doc: "A setting to determine whether a source's tiles are cached locally.",
"sdk-support": {
"basic functionality": {
android: "9.3.0",
ios: "5.10.0"
}
}
},
"*": {
type: "*",
doc: "Other keys to configure the data source."
}
};
var source_raster = {
type: {
required: true,
type: "enum",
values: {
raster: {
doc: "A raster tile source."
}
},
doc: "The type of the source."
},
url: {
type: "string",
doc: "A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<Tileset ID>`."
},
tiles: {
type: "array",
value: "string",
doc: "An array of one or more tile source URLs, as in the TileJSON spec."
},
bounds: {
type: "array",
value: "number",
length: 4,
"default": [
-180,
-85.051129,
180,
85.051129
],
doc: "An array containing the longitude and latitude of the southwest and northeast corners of the source's bounding box in the following order: `[sw.lng, sw.lat, ne.lng, ne.lat]`. When this property is included in a source, no tiles outside of the given bounds are requested by Mapbox GL."
},
minzoom: {
type: "number",
"default": 0,
doc: "Minimum zoom level for which tiles are available, as in the TileJSON spec."
},
maxzoom: {
type: "number",
"default": 22,
doc: "Maximum zoom level for which tiles are available, as in the TileJSON spec. Data from tiles at the maxzoom are used when displaying the map at higher zoom levels."
},
tileSize: {
type: "number",
"default": 512,
units: "pixels",
doc: "The minimum visual size to display tiles for this layer. Only configurable for raster layers."
},
scheme: {
type: "enum",
values: {
xyz: {
doc: "Slippy map tilenames scheme."
},
tms: {
doc: "OSGeo spec scheme."
}
},
"default": "xyz",
doc: "Influences the y direction of the tile coordinates. The global-mercator (aka Spherical Mercator) profile is assumed."
},
attribution: {
type: "string",
doc: "Contains an attribution to be displayed when the map is shown to a user."
},
volatile: {
type: "boolean",
"default": false,
doc: "A setting to determine whether a source's tiles are cached locally.",
"sdk-support": {
"basic functionality": {
android: "9.3.0",
ios: "5.10.0"
}
}
},
"*": {
type: "*",
doc: "Other keys to configure the data source."
}
};
var source_raster_dem = {
type: {
required: true,
type: "enum",
values: {
"raster-dem": {
doc: "A RGB-encoded raster DEM source"
}
},
doc: "The type of the source."
},
url: {
type: "string",
doc: "A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<Tileset ID>`."
},
tiles: {
type: "array",
value: "string",
doc: "An array of one or more tile source URLs, as in the TileJSON spec."
},
bounds: {
type: "array",
value: "number",
length: 4,
"default": [
-180,
-85.051129,
180,
85.051129
],
doc: "An array containing the longitude and latitude of the southwest and northeast corners of the source's bounding box in the following order: `[sw.lng, sw.lat, ne.lng, ne.lat]`. When this property is included in a source, no tiles outside of the given bounds are requested by Mapbox GL."
},
minzoom: {
type: "number",
"default": 0,
doc: "Minimum zoom level for which tiles are available, as in the TileJSON spec."
},
maxzoom: {
type: "number",
"default": 22,
doc: "Maximum zoom level for which tiles are available, as in the TileJSON spec. Data from tiles at the maxzoom are used when displaying the map at higher zoom levels."
},
tileSize: {
type: "number",
"default": 512,
units: "pixels",
doc: "The minimum visual size to display tiles for this layer. Only configurable for raster layers."
},
attribution: {
type: "string",
doc: "Contains an attribution to be displayed when the map is shown to a user."
},
encoding: {
type: "enum",
values: {
terrarium: {
doc: "Terrarium format PNG tiles. See https://aws.amazon.com/es/public-datasets/terrain/ for more info."
},
mapbox: {
doc: "Mapbox Terrain RGB tiles. See https://www.mapbox.com/help/access-elevation-data/#mapbox-terrain-rgb for more info."
}
},
"default": "mapbox",
doc: "The encoding used by this source. Mapbox Terrain RGB is used by default"
},
volatile: {
type: "boolean",
"default": false,
doc: "A setting to determine whether a source's tiles are cached locally.",
"sdk-support": {
"basic functionality": {
android: "9.3.0",
ios: "5.10.0"
}
}
},
"*": {
type: "*",
doc: "Other keys to configure the data source."
}
};
var source_geojson = {
type: {
required: true,
type: "enum",
values: {
geojson: {
doc: "A GeoJSON data source."
}
},
doc: "The data type of the GeoJSON source."
},
data: {
type: "*",
doc: "A URL to a GeoJSON file, or inline GeoJSON."
},
maxzoom: {
type: "number",
"default": 18,
doc: "Maximum zoom level at which to create vector tiles (higher means greater detail at high zoom levels)."
},
attribution: {
type: "string",
doc: "Contains an attribution to be displayed when the map is shown to a user."
},
buffer: {
type: "number",
"default": 128,
maximum: 512,
minimum: 0,
doc: "Size of the tile buffer on each side. A value of 0 produces no buffer. A value of 512 produces a buffer as wide as the tile itself. Larger values produce fewer rendering artifacts near tile edges and slower performance."
},
filter: {
type: "*",
doc: "An expression for filtering features prior to processing them for rendering."
},
tolerance: {
type: "number",
"default": 0.375,
doc: "Douglas-Peucker simplification tolerance (higher means simpler geometries and faster performance)."
},
cluster: {
type: "boolean",
"default": false,
doc: "If the data is a collection of point features, setting this to true clusters the points by radius into groups. Cluster groups become new `Point` features in the source with additional properties:\n * `cluster` Is `true` if the point is a cluster \n * `cluster_id` A unqiue id for the cluster to be used in conjunction with the [cluster inspection methods](https://www.mapbox.com/mapbox-gl-js/api/#geojsonsource#getclusterexpansionzoom)\n * `point_count` Number of original points grouped into this cluster\n * `point_count_abbreviated` An abbreviated point count"
},
clusterRadius: {
type: "number",
"default": 50,
minimum: 0,
doc: "Radius of each cluster if clustering is enabled. A value of 512 indicates a radius equal to the width of a tile."
},
clusterMaxZoom: {
type: "number",
doc: "Max zoom on which to cluster points if clustering is enabled. Defaults to one zoom less than maxzoom (so that last zoom features are not clustered). Clusters are re-evaluated at integer zoom levels so setting clusterMaxZoom to 14 means the clusters will be displayed until z15."
},
clusterMinPoints: {
type: "number",
doc: "Minimum number of points necessary to form a cluster if clustering is enabled. Defaults to `2`."
},
clusterProperties: {
type: "*",
doc: "An object defining custom properties on the generated clusters if clustering is enabled, aggregating values from clustered points. Has the form `{\"property_name\": [operator, map_expression]}`. `operator` is any expression function that accepts at least 2 operands (e.g. `\"+\"` or `\"max\"`) — it accumulates the property value from clusters/points the cluster contains; `map_expression` produces the value of a single point.\n\nExample: `{\"sum\": [\"+\", [\"get\", \"scalerank\"]]}`.\n\nFor more advanced use cases, in place of `operator`, you can use a custom reduce expression that references a special `[\"accumulated\"]` value, e.g.:\n`{\"sum\": [[\"+\", [\"accumulated\"], [\"get\", \"sum\"]], [\"get\", \"scalerank\"]]}`"
},
lineMetrics: {
type: "boolean",
"default": false,
doc: "Whether to calculate line distance metrics. This is required for line layers that specify `line-gradient` values."
},
generateId: {
type: "boolean",
"default": false,
doc: "Whether to generate ids for the geojson features. When enabled, the `feature.id` property will be auto assigned based on its index in the `features` array, over-writing any previous values."
},
promoteId: {
type: "promoteId",
doc: "A property to use as a feature id (for feature state). Either a property name, or an object of the form `{<sourceLayer>: <propertyName>}`."
}
};
var source_video = {
type: {
required: true,
type: "enum",
values: {
video: {
doc: "A video data source."
}
},
doc: "The data type of the video source."
},
urls: {
required: true,
type: "array",
value: "string",
doc: "URLs to video content in order of preferred format."
},
coordinates: {
required: true,
doc: "Corners of video specified in longitude, latitude pairs.",
type: "array",
length: 4,
value: {
type: "array",
length: 2,
value: "number",
doc: "A single longitude, latitude pair."
}
}
};
var source_image = {
type: {
required: true,
type: "enum",
values: {
image: {
doc: "An image data source."
}
},
doc: "The data type of the image source."
},
url: {
required: true,
type: "string",
doc: "URL that points to an image."
},
coordinates: {
required: true,
doc: "Corners of image specified in longitude, latitude pairs.",
type: "array",
length: 4,
value: {
type: "array",
length: 2,
value: "number",
doc: "A single longitude, latitude pair."
}
}
};
var layer = {
id: {
type: "string",
doc: "Unique layer name.",
required: true
},
type: {
type: "enum",
values: {
fill: {
doc: "A filled polygon with an optional stroked border.",
"sdk-support": {
"basic functionality": {
js: "0.10.0",
android: "2.0.1",
ios: "2.0.0",
macos: "0.1.0"
}
}
},
line: {
doc: "A stroked line.",
"sdk-support": {
"basic functionality": {
js: "0.10.0",
android: "2.0.1",
ios: "2.0.0",
macos: "0.1.0"
}
}
},
symbol: {
doc: "An icon or a text label.",
"sdk-support": {
"basic functionality": {
js: "0.10.0",
android: "2.0.1",
ios: "2.0.0",
macos: "0.1.0"
}
}
},
circle: {
doc: "A filled circle.",
"sdk-support": {
"basic functionality": {
js: "0.10.0",
android: "2.0.1",
ios: "2.0.0",
macos: "0.1.0"
}
}
},
heatmap: {
doc: "A heatmap.",
"sdk-support": {
"basic functionality": {
js: "0.41.0",
android: "6.0.0",
ios: "4.0.0",
macos: "0.7.0"
}
}
},
"fill-extrusion": {
doc: "An extruded (3D) polygon.",
"sdk-support": {
"basic functionality": {
js: "0.27.0",
android: "5.1.0",
ios: "3.6.0",
macos: "0.5.0"
}
}
},
raster: {
doc: "Raster map textures such as satellite imagery.",
"sdk-support": {
"basic functionality": {
js: "0.10.0",
android: "2.0.1",
ios: "2.0.0",
macos: "0.1.0"
}
}
},
hillshade: {
doc: "Client-side hillshading visualization based on DEM data. Currently, the implementation only supports Mapbox Terrain RGB and Mapzen Terrarium tiles.",
"sdk-support": {
"basic functionality": {
js: "0.43.0",
android: "6.0.0",
ios: "4.0.0",
macos: "0.7.0"
}
}
},
background: {
doc: "The background color or pattern of the map.",
"sdk-support": {
"basic functionality": {
js: "0.10.0",
android: "2.0.1",
ios: "2.0.0",
macos: "0.1.0"
}
}
},
sky: {
doc: "A spherical dome around the map that is always rendered behind all other layers.",
"sdk-support": {
"basic functionality": {
js: "2.0.0"
}
}
}
},
doc: "Rendering type of this layer.",
required: true
},
metadata: {
type: "*",
doc: "Arbitrary properties useful to track with the layer, but do not influence rendering. Properties should be prefixed to avoid collisions, like 'mapbox:'."
},
source: {
type: "string",
doc: "Name of a source description to be used for this layer. Required for all layer types except `background`."
},
"source-layer": {
type: "string",
doc: "Layer to use from a vector tile source. Required for vector tile sources; prohibited for all other source types, including GeoJSON sources."
},
minzoom: {
type: "number",
minimum: 0,
maximum: 24,
doc: "The minimum zoom level for the layer. At zoom levels less than the minzoom, the layer will be hidden."
},
maxzoom: {
type: "number",
minimum: 0,
maximum: 24,
doc: "The maximum zoom level for the layer. At zoom levels equal to or greater than the maxzoom, the layer will be hidden."
},
filter: {
type: "filter",
doc: "A expression specifying conditions on source features. Only features that match the filter are displayed. Zoom expressions in filters are only evaluated at integer zoom levels. The `feature-state` expression is not supported in filter expressions."
},
layout: {
type: "layout",
doc: "Layout properties for the layer."
},
paint: {
type: "paint",
doc: "Default paint properties for this layer."
}
};
var layout = [
"layout_fill",
"layout_line",
"layout_circle",
"layout_heatmap",
"layout_fill-extrusion",
"layout_symbol",
"layout_raster",
"layout_hillshade",
"layout_background",
"layout_sky"
];
var layout_background = {
visibility: {
type: "enum",
values: {
visible: {
doc: "The layer is shown."
},
none: {
doc: "The layer is not shown."
}
},
"default": "visible",
doc: "Whether this layer is displayed.",
"sdk-support": {
"basic functionality": {
js: "0.10.0",
android: "2.0.1",
ios: "2.0.0",
macos: "0.1.0"
}
},
"property-type": "constant"
}
};
var layout_sky = {
visibility: {
type: "enum",
values: {
visible: {
doc: "The layer is shown."
},
none: {
doc: "The layer is not shown."
}
},
"default": "visible",
doc: "Whether this layer is displayed.",
"sdk-support": {
"basic functionality": {
js: "2.0.0"
}
},
"property-type": "constant"
}
};
var layout_fill = {
"fill-sort-key": {
type: "number",
doc: "Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key.",
"sdk-support": {
"basic functionality": {
js: "1.2.0",
android: "9.1.0",
ios: "5.8.0",
macos: "0.15.0"
},
"data-driven styling": {
js: "1.2.0",
android: "9.1.0",
ios: "5.8.0",
macos: "0.15.0"
}
},
expression: {
interpolated: false,
parameters: [
"zoom",
"feature"
]
},
"property-type": "data-driven"
},
visibility: {
type: "enum",
values: {
visible: {
doc: "The layer is shown."
},
none: {
doc: "The layer is not shown."
}
},
"default": "visible",
doc: "Whether this layer is displayed.",
"sdk-support": {
"basic functionality": {
js: "0.10.0",
android: "2.0.1",
ios: "2.0.0",
macos: "0.1.0"
}
},
"property-type": "constant"
}
};
var layout_circle = {
"circle-sort-key": {
type: "number",
doc: "Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key.",
"sdk-support": {
"basic functionality": {
js: "1.2.0",
android: "9.2.0",
ios: "5.9.0",
macos: "0.16.0"
},
"data-driven styling": {
js: "1.2.0",
android: "9.2.0",
ios: "5.9.0",
macos: "0.16.0"
}
},
expression: {
interpolated: false,
parameters: [
"zoom",
"feature"
]
},
"property-type": "data-driven"
},
visibility: {
type: "enum",
values: {
visible: {
doc: "The layer is shown."
},
none: {
doc: "The layer is not shown."
}
},
"default": "visible",
doc: "Whether this layer is displayed.",
"sdk-support": {
"basic functionality": {
js: "0.10.0",
android: "2.0.1",
ios: "2.0.0",
macos: "0.1.0"
}
},
"property-type": "constant"
}
};
var layout_heatmap = {
visibility: {
type: "enum",
values: {
visible: {
doc: "The layer is shown."
},
none: {
doc: "The layer is not shown."
}
},
"default": "visible",
doc: "Whether this layer is displayed.",
"sdk-support": {
"basic functionality": {
js: "0.41.0",
android: "6.0.0",
ios: "4.0.0",
macos: "0.7.0"
}
},
"property-type": "constant"
}
};
var layout_line = {
"line-cap": {
type: "enum",
values: {
butt: {
doc: "A cap with a squared-off end which is drawn to the exact endpoint of the line."
},
round: {
doc: "A cap with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the line's width and centered on the endpoint of the line."
},
square: {
doc: "A cap with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line's width."
}
},
"default": "butt",
doc: "The display of line endings.",
"sdk-support": {
"basic functionality": {
js: "0.10.0",
android: "2.0.1",
ios: "2.0.0",
macos: "0.1.0"
},
"data-driven styling": {
js: "2.3.0"
}
},
expression: {
interpolated: false,
parameters: [
"zoom",
"feature"
]
},
"property-type": "data-driven"
},
"line-join": {
type: "enum",
values: {
bevel: {
doc: "A join with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line's width."
},
round: {
doc: "A join with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the line's width and centered on the endpoint of the line."
},
miter: {
doc: "A join with a sharp, angled corner which is drawn with the outer sides beyond the endpoint of the path until they meet."
}
},
"default": "miter",
doc: "The display of lines when joining.",
"sdk-support": {
"basic functionality": {
js: "0.10.0",
android: "2.0.1",
ios: "2.0.0",
macos: "0.1.0"
},
"data-driven styling": {
js: "0.40.0",
android: "5.2.0",
ios: "3.7.0",
macos: "0.6.0"
}
},
expression: {
interpolated: false,
parameters: [
"zoom",
"feature"
]
},
"property-type": "data-driven"
},
"line-miter-limit": {
type: "number",
"default": 2,
doc: "Used to automatically convert miter joins to bevel joins for sharp angles.",
requires: [
{
"line-join": "miter"
}
],
"sdk-support": {
"basic functionality": {
js: "0.10.0",
android: "2.0.1",
ios: "2.0.0",
macos: "0.1.0"
}
},
expression: {
interpolated: true,
parameters: [
"zoom"
]
},
"property-type": "data-constant"
},
"line-round-limit": {
type: "number",
"default": 1.05,
doc: "Used to automatically convert round joins to miter joins for shallow angles.",
requires: [
{
"line-join": "round"
}
],
"sdk-support": {
"basic functionality": {
js: "0.10.0",
android: "2.0.1",
ios: "2.0.0",
macos: "0.1.0"
}
},
expression: {
interpolated: true,
parameters: [
"zoom"
]
},
"property-type": "data-constant"
},
"line-sort-key": {
type: "number",
doc: "Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key.",
"sdk-support": {
"basic functionality": {
js: "1.2.0",
android: "9.1.0",
ios: "5.8.0",
macos: "0.15.0"
},
"data-driven styling": {
js: "1.2.0",
android: "9.1.0",
ios: "5.8.0",
macos: "0.15.0"
}
},
expression: {
interpolated: false,
parameters: [
"zoom",
"feature"
]
},
"property-type": "data-driven"
},
visibility: {
type: "enum",
values: {
visible: {
doc: "The layer is shown."
},
none: {
doc: "The layer is not shown."
}
},
"default": "visible",
doc: "Whether this layer is displayed.",
"sdk-support": {
"basic functionality": {
js: "0.10.0",
android: "2.0.1",
ios: "2.0.0",
macos: "0.1.0"
}
},
"property-type": "constant"
}
};
var layout_symbol = {
"symbol-placement": {
type: "enum",
values: {
point: {
doc: "The label is placed at the point where the geometry is located."
},
line: {
doc: "The label is placed along the line of the geometry. Can only be used on `LineString` and `Polygon` geometries."
},
"line-center": {
doc: "The label is placed at the center of the line of the geometry. Can only be used on `LineString` and `Polygon` geometries. Note that a single feature in a vector tile may contain multiple line geometries."
}
},
"default": "point",
doc: "Label placement relative to its geometry.",
"sdk-support": {
"basic functionality": {
js: "0.10.0",
android: "2.0.1",
ios: "2.0.0",
macos: "0.1.0"
},
"`line-center` value": {
js: "0.47.0",
android: "6.4.0",
ios: "4.3.0",
macos: "0.10.0"
}
},
expression: {
interpolated: false,
parameters: [
"zoom"
]
},
"property-type": "data-constant"
},
"symbol-spacing": {
type: "number",
"default": 250,
minimum: 1,
units: "pixels",
doc: "Distance between two symbol anchors.",
requires: [
{
"symbol-placement": "line"
}
],
"sdk-support": {
"basic functionality": {
js: "0.10.0",
android: "2.0.1",
ios: "2.0.0",
macos: "0.1.0"
}
},
expression: {
interpolated: true,
parameters: [
"zoom"
]
},
"property-type": "data-constant"
},
"symbol-avoid-edges": {
type: "boolean",
"default": false,
doc: "If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer. When using a client that supports global collision detection, like Mapbox GL JS version 0.42.0 or greater, enabling this property is not needed to prevent clipped labels at tile boundaries.",
"sdk-support": {
"basic functionality": {
js: "0.10.0",
android: "2.0.1",
ios: "2.0.0",
macos: "0.1.0"
}
},
expression: {
interpolated: false,
parameters: [
"zoom"
]
},
"property-type": "data-constant"
},
"symbol-sort-key": {
type: "number",
doc: "Sorts features in ascending order based on this value. Features with lower sort keys are drawn and placed first. When `icon-allow-overlap` or `text-allow-overlap` is `false`, features with a lower sort key will have priority during placement. When `icon-allow-overlap` or `text-allow-overlap` is set to `true`, features with a higher sort key will overlap over features with a lower sort key.",
"sdk-support": {
"basic functionality": {
js: "0.53.0",
android: "7.4.0",
ios: "4.11.0",
macos: "0.14.0"
},
"data-driven styling": {
js: "0.53.0",
android: "7.4.0",
ios: "4.11.0",
macos: "0.14.0"
}
},
expression: {
interpolated: false,
parameters: [
"zoom",
"feature"
]
},
"property-type": "data-driven"
},
"symbol-z-order": {
type: "enum",
values: {
auto: {
doc: "Sorts symbols by `symbol-sort-key` if set. Otherwise, sorts symbols by their y-position relative to the viewport if `icon-allow-overlap` or `text-allow-overlap` is set to `true` or `icon-ignore-placement` or `text-ignore-placement` is `false`."
},
"viewport-y": {
doc: "Sorts symbols by their y-position relative to the viewport if `icon-allow-overlap` or `text-allow-overlap` is set to `true` or `icon-ignore-placement` or `text-ignore-placement` is `false`."
},
source: {
doc: "Sorts symbols by `symbol-sort-key` if set. Otherwise, no sorting is applied; symbols are rendered in the same order as the source data."
}
},
"default": "auto",
doc: "Determines whether overlapping symbols in the same layer are rendered in the order that they appear in the data source or by their y-position relative to the viewport. To control the order and prioritization of symbols otherwise, use `symbol-sort-key`.",
"sdk-support": {
"basic functionality": {
js: "0.49.0",
android: "6.6.0",
ios: "4.5.0",
macos: "0.12.0"
}
},
expression: {
interpolated: false,
parameters: [
"zoom"
]
},
"property-type": "data-constant"
},
"icon-allow-overlap": {
type: "boolean",
"default": false,
doc: "If true, the icon will be visible even if it collides with other previously drawn symbols.",
requires: [
"icon-image"
],
"sdk-support": {
"basic functionality": {
js: "0.10.0",
android: "2.0.1",
ios: "2.0.0",
macos: "0.1.0"
}
},
expression: {
interpolated: false,
parameters: [
"zoom"
]
},
"property-type": "data-constant"
},
"icon-ignore-placement": {
type: "boolean",
"default": false,
doc: "If true, other symbols can be visible even if they collide with the icon.",
requires: [
"icon-image"
],
"sdk-support": {
"basic functionality": {
js: "0.10.0",
android: "2.0.1",
ios: "2.0.0",
macos: "0.1.0"
}
},
expression: {
interpolated: false,
parameters: [
"zoom"
]
},
"property-type": "data-constant"
},
"icon-optional": {
type: "boolean",
"default": false,
doc: "If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not.",
requires: [
"icon-image",
"text-field"
],
"sdk-support": {
"basic functionality": {
js: "0.10.0",
android: "2.0.1",
ios: "2.0.0",
macos: "0.1.0"
}
},
expression: {
interpolated: false,
parameters: [
"zoom"
]
},
"property-type": "data-constant"
},
"icon-rotation-alignment": {
type: "enum",
values: {
map: {
doc: "When `symbol-placement` is set to `point`, aligns icons east-west. When `symbol-placement` is set to `line` or `line-center`, aligns icon x-axes with the line."
},
viewport: {
doc: "Produces icons whose x-axes are aligned with the x-axis of the viewport, regardless of the value of `symbol-placement`."
},
auto: {
doc: "When `symbol-placement` is set to `point`, this is equivalent to `viewport`. When `symbol-placement` is set to `line` or `line-center`, this is equivalent to `map`."
}
},
"default": "auto",
doc: "In combination with `symbol-placement`, determines the rotation behavior of icons.",
requires: [
"icon-image"
],
"sdk-support": {
"basic functionality": {
js: "0.10.0",
android: "2.0.1",
ios: "2.0.0",
macos: "0.1.0"
},
"`auto` value": {
js: "0.25.0",
android: "4.2.0",
ios: "3.4.0",
macos: "0.3.0"
}
},
expression: {
interpolated: false,
parameters: [
"zoom"
]
},
"property-type": "data-constant"
},
"icon-size": {
type: "number",
"default": 1,
minimum: 0,
units: "factor of the original icon size",
doc: "Scales the original size of the icon by the provided factor. The new pixel size of the image will be the original pixel size multiplied by `icon-size`. 1 is the original size; 3 triples the size of the image.",
requires: [
"icon-image"
],
"sdk-support": {
"basic functionality": {
js: "0.10.0",
android: "2.0.1",
ios: "2.0.0",
macos: "0.1.0"
},
"data-driven styling": {
js: "0.35.0",
android: "5.1.0",
ios: "3.6.0",
macos: "0.5.0"
}
},
expression: {
interpolated: true,
parameters: [
"zoom",
"feature"
]
},
"property-type": "data-driven"
},
"icon-text-fit": {
type: "enum",
values: {
none: {
doc: "The icon is displayed at its intrinsic aspect ratio."
},
width: {
doc: "The icon is scaled in the x-dimension to fit the width of the text."
},
height: {
doc: "The icon is scaled in the y-dimension to fit the height of the text."
},
both: {
doc: "The icon is scaled in both x- and y-dimensions."
}
},
"default": "none",
doc: "Scales the icon to fit around the associated text.",
requires: [
"icon-image",
"text-field"
],
"sdk-support": {
"basic functionality": {
js: "0.21.0",
android: "4.2.0",
ios: "3.4.0",
macos: "0.2.1"
},
"stretchable icons": {
js: "1.6.0",
android: "9.2.0",
ios: "5.8.0",
macos: "0.15.0"
}
},
expression: {
interpolated: false,
parameters: [
"zoom"
]
},