3.1 Funcions
LngLatBounds
LngLatBounds
new LngLatBounds([sw], [ne])
Constructs a new LngLatBounds object representing a geographical bounding box.
Param | Type | Description |
---|---|---|
[sw] | LngLatLike |
The southwest corner of the bounding box. Can be specified as an array of 4 numbers in the order of west, south, east, north, or an array of 2 LngLatLike representing [sw,ne]. |
[ne] | LngLatLike |
The northeast corner of the bounding box. |
addGeocoderICGC([position]) →Object
Add geocoder.
Kind: global function
Returns: Object
- - The current position of the search result.
Param | Type | Default | Description |
---|---|---|---|
[position] | string |
"'top-right'" |
Position to add the control on the map. |
getConfigStyles() →Array
Retrieves the available base styles from default options.
Kind: global function
Returns: Array
- - Array containing the names of available base styles.
getConfigWMSLayers() →Array
Retrieves the available WMS image layers from default options.
Kind: global function
Returns: Array
- - Array containing the keys of available WMS image layers.
getConfigOrtoLayers() →Array
Retrieves the available orto image layers from default options.
Kind: global function
Returns: Array
- - Array containing the keys of available image layers.
getConfigVectorLayers() →Array
Retrieves the available vector layers from default options.
Kind: global function
Returns: Array
- - Array containing the keys of available vector layers.
getConfigVectorAdminLayers() →Array
Retrieves the available vector layers from default options.
Kind: global function
Returns: Array
- - Array containing the keys of available vectorAdmin layers.
getConfigFGBAdminLayers() →Array
Retrieves the available fgb layers from default options.
Kind: global function
Returns: Array
- - Array containing the keys of available fgbadmin layers.
fetchData(url, idLayer, options)
Fetches GeoJSON data from a URL and adds a corresponding layer to the map based on the specified geometry type.
Kind: global function
Param | Type | Description |
---|---|---|
url | string |
The URL to fetch GeoJSON data from. |
idLayer | string |
The id for the layer. |
options | Object |
Additional options for configuring the layer. |
fetchDataAndMenu(url, idLayer, filterField, options)
Fetches GeoJSON data from a URL and adds a corresponding layer to the map based on the specified geometry type and adds to the Menu as a checkbox item.
Kind: global function
Param | Type | Description |
---|---|---|
url | string |
The URL to fetch GeoJSON data from. |
idLayer | string |
The geometry name (e.g., 'buildings'). |
filterField | string |
Import all features as unique or group based on a field ('all', 'field'). |
options | Object |
Additional options for configuring the layer. |
on(type, func)
Adds an event listener to the map.
Kind: global function
Param | Type | Description |
---|---|---|
type | string |
The type of the event. |
func | function |
The callback function to be executed when the event occurs. |
setStyle(style, [options])
Sets the style of the map.
Kind: global function
Param | Type | Description |
---|---|---|
style | string |
Name of the map style. |
[options] | Object |
Options for setting the style. |
addControl(control, [position])
Adds a control to the map with the specified position.
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
control | Object |
The control to add. | |
[position] | string |
"'top-right'" |
Position to add the control on the map. |
setSky(options)
Sets the sky properties of the map.
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
options | Object |
Options to set the sky properties. | |
[options.skyType] | string |
"'gradient'" |
Type of sky to set (e.g., 'gradient', 'atmosphere'). |
[options.color] | string |
"'lightblue'" |
Color of the sky. |
[options.horizonBlend] | Number |
0.03 |
Blend horizon value. |
[options.starIntensity] | Number |
0.5 |
Intensity of stars in the sky. |
[options.sunIntensity] | Number |
0.1 |
Intensity of the sun in the sky. |
[options.sunPosition] | Array.<Number> |
[0, 0] |
Position of the sun in the sky. |
addMouseCoordControl([position])
Adds a mouse coordinate control to the map.
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
options.width | Number |
Width control i. | |
options.utm | Boolean |
Boolean to show coordinates in UTM. | |
options.lonlat | Boolean |
Boolean to show coordinates in Lon Lat. | |
[position] | string |
"'bottom-left'" |
Position to add the control on the map. |
addGeolocateControl(options, [position])
Adds a geolocate control to the map.
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
options | Object |
Options for the geolocate control. | |
[position] | string |
"'top-right'" |
Position to add the control on the map. |
addFullscreenControl(options, [position])
Adds a fullscreen control to the map.
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
options | Object |
Options for the geolocate control. | |
[position] | string |
"'top-right'" |
Position to add the control on the map. |
addLayer(layer, layerIdOrder)
Adds a layer to the map.
Kind: global function
Param | Type | Description |
---|---|---|
layer | Object |
Options for the layer to add. |
layerIdOrder | string |
Optional layer Id draw position. |
addImage(id, image, options) →this
Adds an image to the map.
Kind: global function
Param | Type | Description |
---|---|---|
id | string |
The ID of the image. |
image | ImageBitmap | HTMLImageElement | ImageData | StyleImageInterface | object |
The image object to add. |
options | Partial.<StyleImageMetadata> |
Optional metadata for the image. |
addSource(id, source) →this
Adds a source to the map.
Kind: global function
Param | Type | Description |
---|---|---|
id | string |
The ID of the source. |
source | SourceSpecification |
The source object to add. |
addSprite(id, url, options) →this
Adds a sprite to the map.
Kind: global function
Param | Type | Description |
---|---|---|
id | string |
The ID of the sprite. |
url | string |
The URL to load the sprite from. |
options | StyleSetterOptions |
Options object. |
areTilesLoaded() →boolean
Checks if all tiles in the viewport are loaded.
cameraForBounds(bounds, options) →CenterZoomBearing
| undefined
Calculates the camera position for given bounds.
Kind: global function
Param | Type | Description |
---|---|---|
bounds | LngLatBoundsLike |
The geographical bounds to fit. |
options | CameraForBoundsOptions |
Options object. |
easeTo(options, eventData) →this
Eases the camera to a new position.
Kind: global function
Param | Type | Description |
---|---|---|
options | object |
Options describing the animation. |
eventData | any |
Additional properties for event objects. |
fitBounds(bounds, options, eventData) →this
Fits the map to the given geographical bounds.
Kind: global function
Param | Type | Description |
---|---|---|
bounds | LngLatBoundsLike |
The geographical bounds to fit. |
options | FitBoundsOptions |
Options object. |
eventData | any |
Additional properties for event objects. |
fitScreenCoordinates(p0, p1, bearing, options, eventData) →this
Fits the map to the given screen coordinates.
Kind: global function
Param | Type | Description |
---|---|---|
p0 | PointLike |
First point on screen, in pixel coordinates. |
p1 | PointLike |
Second point on screen, in pixel coordinates. |
bearing | number |
Desired map bearing at end of animation, in degrees. |
options | FitBoundsOptions |
Options object. |
eventData | any |
Additional properties for event objects. |
flyTo(options, eventData) →this
Flies the camera to a new position.
Kind: global function
Param | Type | Description |
---|---|---|
options | FlyToOptions |
Options describing the flight. |
eventData | any |
Additional properties for event objects. |
getBearing() →number
Gets the current bearing of the map.
getBounds() →LngLatBounds
Gets the current geographical bounds of the map.
getCameraTargetElevation() →number
Gets the elevation for the point where the camera is looking.
getCanvas() →HTMLCanvasElement
Gets the map's
getCanvasContainer() →HTMLElement
Gets the HTML element containing the map's
getCenter() →LngLat
Returns the map's geographical centerpoint.
Kind: global function
Returns: LngLat
- The map's geographical centerpoint.
getContainer() →HTMLElement
Returns the map's containing HTML element.
Kind: global function
Returns: HTMLElement
- The map's container.
getFeatureState(feature) →any
Gets the state of a feature.
Kind: global function
Returns: any
- The state of the feature.
Param | Type | Description |
---|---|---|
feature | FeatureIdentifier |
Feature identifier. |
getFilter(layerId) →void
| FilterSpecification
Returns the filter applied to the specified style layer.
Kind: global function
Returns: void
| FilterSpecification
- The layer's filter.
Param | Type | Description |
---|---|---|
layerId | string |
The ID of the style layer. |
getGlyphs() →string
Returns the value of the style's glyphs URL.
Kind: global function
Returns: string
- The glyphs Style's glyphs URL.
getImage(id) →StyleImage
Returns an image currently available in the map.
Kind: global function
Returns: StyleImage
- An image in the map with the specified ID.
Param | Type | Description |
---|---|---|
id | string |
The ID of the image. |
getLayer(id) →StyleLayer
Returns the layer with the specified ID in the map's style.
Kind: global function
Returns: StyleLayer
- The layer with the specified ID.
Param | Type | Description |
---|---|---|
id | string |
The ID of the layer to get. |
getLayersOrder() →Array.<string>
Return the ids of all layers currently in the style, including custom layers, in order.
Kind: global function
Returns: Array.<string>
- Ids of layers, in order.
getLayoutProperty(layerId, name) →any
Returns the value of a layout property in the specified style layer.
Kind: global function
Returns: any
- The value of the specified layout property.
Param | Type | Description |
---|---|---|
layerId | string |
The ID of the layer. |
name | string |
The name of the layout property. |
getLight() →LightSpecification
Returns the value of the light object.
Kind: global function
Returns: LightSpecification
- Light properties of the style.
getMaxBounds() →LngLatBounds
Returns the maximum geographical bounds the map is constrained to.
Kind: global function
Returns: LngLatBounds
- The map's maximum geographical bounds.
getMaxPitch() →number
Returns the map's maximum allowable pitch.
Kind: global function
Returns: number
- The maxPitch.
getMaxZoom() →number
Returns the map's maximum allowable zoom level.
Kind: global function
Returns: number
- The maxZoom.
getMinPitch() →number
Returns the map's minimum allowable pitch.
Kind: global function
Returns: number
- The minPitch.
getMinZoom() →number
Returns the map's minimum allowable zoom level.
Kind: global function
Returns: number
- The minZoom.
getPadding() →PaddingOptions
Returns the current padding applied around the map viewport.
Kind: global function
Returns: PaddingOptions
- The current padding around the map viewport.
getPaintProperty(layerId, name) →unknown
Returns the value of a paint property in the specified style layer.
Kind: global function
Returns: unknown
- The value of the specified paint property.
Param | Type | Description |
---|---|---|
layerId | string |
The ID of the layer. |
name | string |
The name of a paint property. |
getPitch() →number
Returns the map's current pitch (tilt).
Kind: global function
Returns: number
- The map's current pitch, measured in degrees away from the plane of the screen.
getPixelRatio() →number
Returns the map's pixel ratio.
Kind: global function
Returns: number
- The pixel ratio.
getRenderWorldCopies() →boolean
Returns the state of renderWorldCopies.
Kind: global function
Returns: boolean
- The renderWorldCopies.
getSource(id) →Source
Returns the source with the specified ID in the map's style.
Kind: global function
Returns: Source
- The style source with the specified ID.
Param | Type | Description |
---|---|---|
id | string |
The ID of the source to get. |
getSprite() →Array.<object>
Returns the as-is value of the style's sprite.
Kind: global function
Returns: Array.<object>
- Style's sprite list of id-url pairs.
getStyle() →StyleSpecification
Returns the map's MapLibre style object.
Kind: global function
Returns: StyleSpecification
- The map's style JSON object.
getTerrain() →TerrainSpecification
Get the terrain-options if terrain is loaded.
Kind: global function
Returns: TerrainSpecification
- The TerrainSpecification passed to setTerrain.
getZoom() →number
Returns the map's current zoom level.
Kind: global function
Returns: number
- The map's current zoom level.
hasControl(control) →boolean
Checks if a control exists on the map.
Kind: global function
Returns: boolean
- true if map contains control.
Param | Type | Description |
---|---|---|
control | IControl |
The IControl to check. |
hasImage(id) →boolean
Check whether or not an image with a specific ID exists in the style.
Kind: global function
Returns: boolean
- A Boolean indicating whether the image exists.
Param | Type | Description |
---|---|---|
id | string |
The ID of the image. |
isMoving() →boolean
Returns true if the map is panning, zooming, rotating, or pitching due to a camera animation or user gesture.
Kind: global function
Returns: boolean
- true if the map is moving.
isRotating() →boolean
Returns true if the map is rotating due to a camera animation or user gesture.
Kind: global function
Returns: boolean
- true if the map is rotating.
isSourceLoaded(id) →boolean
Returns a Boolean indicating whether the source is loaded.
Kind: global function
Returns: boolean
- A Boolean indicating whether the source is loaded.
Param | Type | Description |
---|---|---|
id | string |
The ID of the source to be checked. |
isStyleLoaded() →boolean
| void
Returns a Boolean indicating whether the map's style is fully loaded.
Kind: global function
Returns: boolean
| void
- A Boolean indicating whether the style is fully loaded.
isZooming() →boolean
Returns true if the map is zooming due to a camera animation or user gesture.
Kind: global function
Returns: boolean
- true if the map is zooming.
jumpTo(options, [eventData]) →this
Changes any combination of center, zoom, bearing, and pitch, without an animated transition.
Kind: global function
Param | Type | Description |
---|---|---|
options | JumpToOptions |
Options object |
[eventData] | any |
Additional properties to be added to event objects of events triggered by this method. |
listImages() →Array.<string>
Returns an Array of strings containing the IDs of all images currently available in the map.
Kind: global function
Returns: Array.<string>
- An Array of strings containing the names of all sprites/images currently available in the map.
listens(type) →boolean
Returns a true if this instance of Evented or any forwardeed instances of Evented have a listener for the specified type.
Kind: global function
Returns: boolean
- true if there is at least one registered listener for specified event type, false otherwise.
Param | Type | Description |
---|---|---|
type | string |
The event type. |
loadImage(url) →Promise.<GetResourceResponse.<(ImageBitmap|HTMLImageElement)>>
Load an image from an external URL to be used with Map#addImage.
Kind: global function
Returns: Promise.<GetResourceResponse.<(ImageBitmap|HTMLImageElement)>>
- A promise that is resolved when the image is loaded.
Param | Type | Description |
---|---|---|
url | string |
The URL of the image file. Image file must be in png, webp, or jpg format. |
loaded() →boolean
Returns a Boolean indicating whether the map is fully loaded.
Kind: global function
Returns: boolean
- A Boolean indicating whether the map is fully loaded.
addProtocol(customProtocol, loadFn) →void
Adds a custom load resource function that will be called when using a URL that starts with a custom URL schema.
Kind: global function
Param | Type | Description |
---|---|---|
customProtocol | string |
The protocol to hook, for example 'custom'. |
loadFn | AddProtocolAction |
The function to use when trying to fetch a resource specified by the customProtocol. |
moveLayer(id, [beforeId]) →this
Moves a layer to a different z-position.
Kind: global function
Param | Type | Description |
---|---|---|
id | string |
The ID of the layer to move. |
[beforeId] | string |
The ID of an existing layer to insert the new layer before. |
panBy(offset, [options], [eventData]) →this
Pans the map by the specified offset.
Kind: global function
Param | Type | Description |
---|---|---|
offset | PointLike |
x and y coordinates by which to pan the map. |
[options] | AnimationOptions |
Options object. |
[eventData] | any |
Additional properties to be added to event objects of events triggered by this method. |
panTo(lnglat, [options], [eventData]) →this
Pans the map to the specified location with an animated transition.
Kind: global function
Param | Type | Description |
---|---|---|
lnglat | LngLatLike |
The location to pan the map to. |
[options] | AnimationOptions |
Options describing the destination and animation of the transition. |
[eventData] | any |
Additional properties to be added to event objects of events triggered by this method. |
project(lnglat) →Point
Returns a Point representing pixel coordinates, relative to the map's container, that correspond to the specified geographical location.
Kind: global function
Returns: Point
- The Point corresponding to lnglat, relative to the map's container.
Param | Type | Description |
---|---|---|
lnglat | LngLatLike |
The geographical location to project. |
queryRenderedFeatures([geometryOrOptions], [options]) →Array
Queries rendered features within a specified geometry or bounding box.
Kind: global function
Returns: Array
- An array of GeoJSON Feature objects representing the features that intersect the query geometry.
Param | Type | Description |
---|---|---|
[geometryOrOptions] | GeometryLike | Array | Object |
The geometry or options for the query. |
[options] | Object |
Options for the query. |
querySourceFeatures(sourceId, parameters) →Array
Queries source features within a specified source.
Kind: global function
Returns: Array
- An array of GeoJSON Feature objects representing the features in the source that satisfy the query parameters.
Param | Type | Description |
---|---|---|
sourceId | string |
The ID of the source to query. |
parameters | Object |
Parameters for the query. |
queryTerrainElevation(lngLatLike) →number
Queries the terrain elevation at a specified geographical location.
Kind: global function
Returns: number
- The elevation (in meters) at the specified location.
Param | Type | Description |
---|---|---|
lngLatLike | LngLatLike |
The geographical location to query. |
redraw() →this
Redraws the map.
remove() →this
Removes the map from the DOM.
removeControl(control) →this
Removes a control from the map.
Kind: global function
Param | Type | Description |
---|---|---|
control | Object |
The control to remove. |
removeFeatureState(target, [key]) →this
Removes the state of a feature.
Kind: global function
Param | Type | Description |
---|---|---|
target | Object |
The target feature. |
[key] | string |
The key of the state to remove. |
removeImage(id) →this
Removes an image from the style's sprite.
Kind: global function
Param | Type | Description |
---|---|---|
id | string |
The ID of the image to remove. |
removeLayer(idLayer)
Removes a layer from the map.
Kind: global function
Param | Type | Description |
---|---|---|
idLayer | string |
Identifier of the layer to remove. |
removeSource(idLayer)
Removes a source from the map.
Kind: global function
Param | Type | Description |
---|---|---|
idLayer | string |
Identifier of the source to remove. |
removeSprite(id) →this
Removes a sprite from the style.
Kind: global function
Param | Type | Description |
---|---|---|
id | string |
The ID of the sprite to remove. |
resetNorth([options], [eventData]) →this
Resets the map orientation so that north is up.
Kind: global function
Param | Type | Description |
---|---|---|
[options] | Object |
Options for the reset. |
[eventData] | any |
Additional properties to be added to event objects of events triggered by this method. |
resetNorthPitch([options], [eventData]) →this
Resets the map orientation so that north is up and pitch is set to 0┬░.
Kind: global function
Param | Type | Description |
---|---|---|
[options] | Object |
Options for the reset. |
[eventData] | any |
Additional properties to be added to event objects of events triggered by this method. |
resize([eventData]) →this
Resizes the map to fit its container.
Kind: global function
Param | Type | Description |
---|---|---|
[eventData] | any |
Additional properties to be added to event objects of events triggered by this method. |
rotateTo(bearing, [options], [eventData]) →this
Rotates the map to the specified bearing with an animated transition.
Kind: global function
Param | Type | Description |
---|---|---|
bearing | number |
The desired bearing (in degrees) to rotate the map to. |
[options] | Object |
Options for the rotation. |
[eventData] | any |
Additional properties to be added to event objects of events triggered by this method. |
setBearing(bearing, [eventData]) →this
Sets the map's bearing with an optional animated transition.
Kind: global function
Param | Type | Description |
---|---|---|
bearing | number |
The desired bearing (in degrees) to set for the map. |
[eventData] | any |
Additional properties to be added to event objects of events triggered by this method. |
setCenter(center, [eventData]) →this
Sets the map's center coordinates with an optional animated transition.
Kind: global function
Param | Type | Description |
---|---|---|
center | LngLatLike |
The desired center coordinates to set for the map. |
[eventData] | any |
Additional properties to be added to event objects of events triggered by this method. |
setEventedParent([parent], [data]) →this
Sets the parent of the map's event emitter.
Kind: global function
Param | Type | Description |
---|---|---|
[parent] | any |
The parent object to set for the event emitter. |
[data] | any |
Additional data to pass to the parent. |
setFeatureState(feature, state) →this
Sets the state of a feature.
Kind: global function
Param | Type | Description |
---|---|---|
feature | Object |
The feature to set the state for. |
state | Object |
The state object to set for the feature. |
setFilter(layerId, [filter], [options]) →this
Sets the filter for a specified layer.
Kind: global function
Param | Type | Description |
---|---|---|
layerId | string |
The ID of the layer to set the filter for. |
[filter] | Array |
The filter array to apply to the layer. |
[options] | Object |
Options for the filter. |
setGlyphs(glyphsUrl, [options]) →this
Sets the glyphs for the map's style.
Kind: global function
Param | Type | Description |
---|---|---|
glyphsUrl | string |
The URL to the glyphs. |
[options] | Object |
Options for setting the glyphs. |
setLayerZoomRange(layerId, minzoom, maxzoom) →this
Sets the zoom range for a specified layer.
Kind: global function
Param | Type | Description |
---|---|---|
layerId | string |
The ID of the layer to set the zoom range for. |
minzoom | number |
The minimum zoom level for the layer. |
maxzoom | number |
The maximum zoom level for the layer. |
setLayoutProperty(layerId, name, value, [options]) →this
Sets a layout property for a specified layer.
Kind: global function
Param | Type | Description |
---|---|---|
layerId | string |
The ID of the layer to set the layout property for. |
name | string |
The name of the layout property to set. |
value | any |
The value to set for the layout property. |
[options] | Object |
Options for setting the layout property. |
setLight(light, [options]) →this
Sets the light for the map's style.
Kind: global function
Param | Type | Description |
---|---|---|
light | Object |
The light object to set for the map. |
[options] | Object |
Options for setting the light. |
setMaxBounds(bounds) →this
Sets the maximum bounds for the map.
Kind: global function
Param | Type | Description |
---|---|---|
bounds | Array |
The maximum bounds for the map. |
setMaxPitch(maxPitch) →this
Sets the maximum pitch for the map.
Kind: global function
Param | Type | Description |
---|---|---|
maxPitch | number |
The maximum pitch (in degrees) for the map. |
setMaxZoom(maxZoom) →this
Sets the maximum zoom level for the map.
Kind: global function
Param | Type | Description |
---|---|---|
maxZoom | number |
The maximum zoom level for the map. |
setMinPitch(minPitch) →this
Sets the minimum pitch for the map.
Kind: global function
Param | Type | Description |
---|---|---|
minPitch | number |
The minimum pitch (in degrees) for the map. |
setMinZoom(minZoom) →this
Sets the minimum zoom level for the map.
Kind: global function
Param | Type | Description |
---|---|---|
minZoom | number |
The minimum zoom level for the map. |
setPadding(padding, [eventData]) →this
Sets padding for the map's container.
Kind: global function
Param | Type | Description |
---|---|---|
padding | Object |
The padding object to set for the map's container. |
[eventData] | any |
Additional properties to be added to event objects of events triggered by this method. |
setPaintProperty(layerId, name, value, [options]) →this
Sets a paint property for a specified layer.
Kind: global function
Param | Type | Description |
---|---|---|
layerId | string |
The ID of the layer to set the paint property for. |
name | string |
The name of the paint property to set. |
value | any |
The value to set for the paint property. |
[options] | Object |
Options for setting the paint property. |
setPitch(pitch, [eventData]) →this
Sets the map's pitch angle with an optional animated transition.
Kind: global function
Param | Type | Description |
---|---|---|
pitch | number |
The desired pitch angle (in degrees) to set for the map. |
[eventData] | any |
Additional properties to be added to event objects of events triggered by this method. |
setPixelRatio(pixelRatio) →this
Sets the pixel ratio for the map.
Kind: global function
Param | Type | Description |
---|---|---|
pixelRatio | number |
The desired pixel ratio for the map. |
setRenderWorldCopies(renderWorldCopies) →this
Sets whether the map should render world copies when the center longitude is greater than or less than ┬▒180 degrees.
Kind: global function
Param | Type | Description |
---|---|---|
renderWorldCopies | boolean |
A boolean indicating whether to render world copies. |
setSprite(spriteUrl, [options]) →this
Sets the sprite for the map's style.
Kind: global function
Param | Type | Description |
---|---|---|
spriteUrl | string |
The URL to the sprite. |
[options] | Object |
Options for setting the sprite. |
setTerrain(options) →this
Loads a 3D terrain mesh based on a "raster-dem" source.
Kind: global function
Param | Type | Description |
---|---|---|
options | TerrainSpecification |
Options object specifying the terrain source. |
setTransformRequest(transformRequest) →this
Updates the requestManager's transform request with a new function.
Kind: global function
Param | Type | Description |
---|---|---|
transformRequest | RequestTransformFunction |
The callback function to update the transform request. |
setZoom(zoom, [eventData]) →this
Sets the map's zoom level.
Kind: global function
Param | Type | Description |
---|---|---|
zoom | number |
The zoom level to set (0-20). |
[eventData] | any |
Additional properties to be added to event objects of events triggered by this method. |
snapToNorth([options], [eventData]) →this
Snaps the map so that north is up (0┬░ bearing), if the current bearing is close enough to it.
Kind: global function
Param | Type | Description |
---|---|---|
[options] | Object |
Options for snapping to north. |
[eventData] | any |
Additional properties to be added to event objects of events triggered by this method. |
stop() →this
Stops any animated transition underway.
triggerRepaint() →void
Triggers the rendering of a single frame.
unproject(point) →LngLat
Returns geographical coordinates corresponding to the specified pixel coordinates.
Kind: global function
Returns: LngLat
- The geographical coordinates corresponding to the specified pixel coordinates.
Param | Type | Description |
---|---|---|
point | PointLike |
The pixel coordinates to unproject. |
updateImage(id, image) →this
Updates an existing image in the style's sprite.
Kind: global function
Param | Type | Description |
---|---|---|
id | string |
The ID of the image to update. |
image | ImageBitmap | HTMLImageElement | ImageData | StyleImageInterface | object |
The new image data. |
zoomIn([options], [eventData]) →this
Increases the map's zoom level by 1.
Kind: global function
Param | Type | Description |
---|---|---|
[options] | Object |
Options for zooming in. |
[eventData] | any |
Additional properties to be added to event objects of events triggered by this method. |
zoomOut([options], [eventData]) →this
Decreases the map's zoom level by 1.
Kind: global function
Param | Type | Description |
---|---|---|
[options] | Object |
Options for zooming out. |
[eventData] | any |
Additional properties to be added to event objects of events triggered by this method. |
zoomTo(zoom, [options], [eventData]) →this
Zooms the map to the specified zoom level with an animated transition.
Kind: global function
Param | Type | Description |
---|---|---|
zoom | number |
The zoom level to transition to. |
[options] | Object |
Options for zooming to. |
[eventData] | any |
Additional properties to be added to event objects of events triggered by this method. |
addLayerGeoJSON(layer, layerPosition)
Adds a GeoJSON layer to the map.
Kind: global function
Param | Type | Description |
---|---|---|
layer | Object |
Options for the GeoJSON layer to add. |
layer.id | string |
Unique identifier for the layer. |
layer.data | Object |
GeoJSON data for the layer. |
layer.type | string |
Map layer type (e.g., 'symbol', 'circle', 'fill'). * |
layer.layout | Object |
Layer layout configuration. |
layer.paint | Object |
Layer paint configuration. |
layerPosition | string |
Position of the layer: 'top', below 'labels' or below 'lines'. |
addLayerWMS(tiles, idLayer, options)
Adds a WMS layer to the map.
Kind: global function
Param | Type | Description |
---|---|---|
tiles | Array.<string> |
Tiles for the raster layer. |
idLayer | string |
Unique identifier for the layer. |
options | Object |
Options of the layer: layout, paint and layerPosition. |
addLogo(options)
Adds a logo to the map.
Kind: global function
Param | Type | Description |
---|---|---|
options | Object |
Options for the logo to add. |
options.id | string |
Unique identifier for the logo. |
options.url | string |
URL of the logo image. |
options.href | string |
URL to navigate to when the logo is clicked. |
options.height | string |
Height of the logo. |
addBasemapsICGC(basesArray)
Adds base layers to the map.
Kind: global function
Param | Type | Description |
---|---|---|
basesArray | Array.<Object> |
Array of base layer objects. |
addBasemaps(baseLayers)
Adds base layers to the map.
Kind: global function
Param | Type | Description |
---|---|---|
baseLayers | Array.<Object> |
Array of base layer objects. |
baseLayers.label | string |
Label for the base layer. |
baseLayers.image | string |
URL of the image representing the base layer. |
baseLayers.url | string |
URL of the base layer style. |
addFeatureQuery(idLayer, queryFields, popupStyle)
Adds feature query function to a layer.
Kind: global function
Param | Type | Description |
---|---|---|
idLayer | string |
name of the layer |
queryFields | objetc |
optional indications for the popup |
popupStyle | objetc |
optional indications for the popup style |
addScaleControl(options, position)
Adds a scale control to the map. * @function addScaleControl
Kind: global function
Param | Type | Description |
---|---|---|
options | Object |
Options for configuring the scale control. |
position | string |
The position on the map to place the scale control (e.g., 'top-left', 'bottom-right'). |
addExportControl(options, [position])
Adds an export control to the map with the provided options and position.
Kind: global function
Param | Type | Description |
---|---|---|
options | Object | string |
Options for the export control or position if provided as a string. |
[position] | string |
Position to place the export control (e.g., 'top-right'). |
addMarker(options) →Object
Adds a marker to the map.
Kind: global function
Returns: Object
- - Instance of the added marker.
Param | Type | Description |
---|---|---|
options | Object |
Options for the marker to add. |
options.text | string |
Text content for the marker popup. |
options.options | Object |
Marker options. |
options.coord | LngLatLike |
Coordinates for placing the marker. |
options.textOffset | Object |
Text offset for the marker popup. |
addPopup(options, coord, text, popupStyle) →Object
Adds a popup to the map.
Kind: global function
Returns: Object
- - Instance of the added popup.
Param | Type | Description |
---|---|---|
options | Object |
Options for the popup to add. |
coord | LngLatLike |
Coordinates for placing the popup. |
text | string |
HTML content for the popup. |
popupStyle | string |
css content for the popup style. |
addFullScreen([position])
Adds a fullscreen control to the map.
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
[position] | string |
"'top-right'" |
Position to add the control on the map. |
addMenuItem(name)
Adds a menu item with a checkbox for controlling the visibility of a layer on the map.
Kind: global function
Param | Type | Description |
---|---|---|
name | string |
The name of the layer corresponding to the menu item. |
addLayerTree(options)
Adds a layer tree to the map.
Kind: global function
Param | Type | Description |
---|---|---|
options | Object |
Options for the layer tree to add. |
options.features | Object |
Features for the layer tree. |
options.id | string |
Unique identifier for the layer tree. |
options.type | string |
Type of layer tree ('geojson', 'raster', etc.). |
createNavigationControl(options, [position]) →Object
Creates a navigation control with the provided options.
Kind: global function
Returns: Object
- - Instance of the created navigation control.
Param | Type | Default | Description |
---|---|---|---|
options | Object |
Options for the navigation control. | |
[position] | string |
"'top-right'" |
Position to add the control on the map. |
addNavigationControl(options, [position])
Adds a navigation control to the map with the provided options.
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
options | Object |
Options for the navigation control. | |
[position] | string |
"'top-right'" |
Position to add the control on the map. |
addAttributionControl(options, [position])
Adds an attribution control to the map with the provided options.
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
options | Object |
Options for the attribution control. | |
[position] | string |
"'bottom-right'" |
Position to add the control on the map. |
addImageLayerICGC(url, idLayer, options)
Adds an ICGC image layer to the map based on the specified name and year.
Kind: global function
Param | Type | Description |
---|---|---|
url | string |
The url of the layer. |
idLayer | string |
The user id for the layer. |
options | object |
Type, position,layout and paint options for the layer |
addVectorLayerICGC(url, idLayer, options)
Adds an ICGC vector layer to the map based on the specified name and year.
Kind: global function
Param | Type | Description |
---|---|---|
url | string |
The url of the vector layer. |
idLayer | string |
The user id for the vector layer. |
options | object |
Type, position,layout and paint options for the layer |
addFGBLayerICGC(url, idLayer, options)
Adds an ICGC FGB layer to the map based on the specified name and year.
Kind: global function
Param | Type | Description |
---|---|---|
url | string |
The url of the FGB layer. |
idLayer | string |
Id for the layer. |
options | object |
Paint option for the layer |
addTerrainICGC(url, controlPosition)
Adds 3D terrain to the map using hillshade.
Kind: global function
Param | Type | Description |
---|---|---|
url | string |
dataset url of the terrain |
controlPosition | string |
Position to add the control on the map. |
addLegend(url, idLayer)
Add image legend.
Kind: global function
Param | Type | Description |
---|---|---|
url | string |
image legend url. |
idLayer | string |
layer's name. |
_findImageType(url, var1, var2, var3, var4) →string
| null
Finds the type of image based on the provided URL and specified vectors.
Kind: global function
Returns: string
| null
- - The type of image if found, otherwise null.
Param | Type | Description |
---|---|---|
url | string |
The URL of the image to find the type for. |
var1 | Object |
The first vector object containing key-value pairs. |
var2 | Object |
The second vector object containing key-value pairs. |
var3 | Object |
The third vector object containing key-value pairs. |
var4 | Object |
The fourth vector object containing key-value pairs. |
_getKeyByUrlFGB(url) →string
| null
Gets the key by URL from the FGBAdmin layers.
Kind: global function
Returns: string
| null
- - The key if found, otherwise null.
Param | Type | Description |
---|---|---|
url | string |
The URL to find the key for in the FGBAdmin layers. |
_getLegendByName(name) →string
| null
Gets the legend by name from the default vector layers.
Kind: global function
Returns: string
| null
- - The legend if found, otherwise null.
Param | Type | Description |
---|---|---|
name | string |
The name of the vector layer to get the legend for. |
_getKeyByUrlVector(url) →string
| null
Gets the key by URL from the Vector layers.
Kind: global function
Returns: string
| null
- - The key if found, otherwise null.
Param | Type | Description |
---|---|---|
url | string |
The URL to find the key for in the Vector layers. |
_raiseText3DStyle() →Promise.<void>
Raises text 3D style on the map.
Kind: global function
Returns: Promise.<void>
- - A promise that resolves after updating the text 3D style on the map.
_dealStyleMaps(name) →Object
| string
| null
Deals with map styles based on the name.
Kind: global function
Returns: Object
| string
| null
- - The map style object if found, or the input name if not found, or null if an error occurs.
Param | Type | Description |
---|---|---|
name | string |
The name of the map style. |
_dealOrto3dStyle(name) →void
| null
Deals with the 3D ortho style based on the name.
Kind: global function
Returns: void
| null
- - Returns null if an error occurs.
Param | Type | Description |
---|---|---|
name | string |
The name of the orto3D style. |
_dealOrderLayer(order) →string
Deals with the order of the layer.
Kind: global function
Returns: string
- - The id of the first symbol layer if the order is 'symbol', the id of the first line layer if the order is 'line', otherwise an empty string.
Param | Type | Description |
---|---|---|
order | string |
The order of the layer. |
_firstSymbolLayer() →string
| undefined
Retrieves the id of the first symbol layer.
Kind: global function
Returns: string
| undefined
- - The id of the first symbol layer if found, otherwise undefined.
_firstLineLayer() →string
| undefined
Retrieves the id of the first line layer.
Kind: global function
Returns: string
| undefined
- - The id of the first line layer if found, otherwise undefined.
_createCitiesMapboxLayer() →MapboxLayer
| null
Creates a Mapbox layer for displaying cities in 3D.
Kind: global function
Returns: MapboxLayer
| null
- - The Mapbox layer for displaying cities in 3D if created successfully, otherwise null.