JMap.Map.applyCurrentPixelRatio
Forces the map to redraw using the current device pixel ratio in usage.
Rejects if the current device pixel ratio/map size
combination is invalid .
This is a technical method that you should never have to use.
JMap.Map.clearFlashingLocations
Immediatly remove all flashed locations on the map that have been displayed using JMap.Map.flashLocation or JMap.Map.flashLocations
JMap.Map.closeModificationPopup
If opened, close the map change popup (for center/scale), else do nothing.
JMap.Map.displayExtent
Displays the given extent
The extent will disappear after a few seconds
a boundary box
(see example)
JMap.Map.displayLayerExtent
Displays the layer extent of the given layer Id
The layer extent will disappear after a few seconds
a layer Id
(see example)
A promise boolean that is true if the layer has an extent or false otherwise.
JMap.Map.fitFeatures
Move and zoom (or unzoom) to display the given features.
The features where the map will be centered
parameter to customize the animation, padding, and/or maxZoomLevel
JMap.Map.flashLocation
Display a pulsing dot on the map to hilite a location, with options
Flashed feature can be immediatly removed using JMap.Map.clearFlashingLocations
a JLocation
(see example)
JMap.Map.flashLocations
Display a collection of pulsing dots on the map to hilite several locations, with options
Flashed features can be immediatly removed using JMap.Map.clearFlashingLocations
an array of JLocations
(see example)
JMap.Map.getAllDistanceUnits
Returns a list of all available distance units.
JMap.Map.getBearing
Returns the current map bearing angle.
JMap.Map.getCenter
Returns the location that is the current center of the map.
JMap.Map.getDistanceUnit
Get the map defined distance unit.
If no distance unit has been set by user, it returns the project distance unit, if no distance unit is set on the project, it returns "meters" by default.
JMap.Map.getDomContainerId
Returns the map div container id, where the map is or will be created.
JMap.Map.getExtent
Returns the current map extent.
JMap.Map.getLayersVisibilityStatus
Returns layers visibility status.
The result is a map (= javascript object) where :
A JMapLayersVisibilityStatus object has the following properties :
'scaleVisibility' and 'extentVisibility' are all true
its visibility property equals to false
cannot be displayed
contains by the current view of the map
JMap.Map.getLayersVisibilityStatusAsArray
Returns layers visibility status as an array of JMapLayersVisibilityStatus object.
A JMapLayersVisibilityStatus object has the following properties :
'scaleVisibility' and 'extentVisibility' are all true
its visibility property equals to false
cannot be displayed
contains by the current view of the map
JMap.Map.getMap
Returns the Mapbox map instance, a MapBox map.
JMap.Map.getMapBoxSourceIdByJMapLayerId
Returns the source id of the given Jmap layer id.
the JMap layer id
JMap.Map.getMapJSLib
Returns the MapBox JS library used to create the map.
Useful to be able to create a map library object, by example a popup.
JMap.Map.getMapboxSupportedJMapLayerIds
Returns all layer ids that are displayed by the map.
Mapbox doesn't support all layer types defined in JMap Server.
This function returns all layers ids that are managed by the map.
JMap.Map.getMouseCursor
Returns the current map mouse cursor.
JMap.Map.getNavigationHistoryStack
Returns the complete stack of navigation steps recorded in the session (stack is limited to 64 entries, older ones are discarded)
an array of JMapNavigationStep
JMap.Map.getBaseMap
Returns the current map pitch.
JMap.Map.getRasterLayerInitialTransparency
Return the initial transparency (defined on the layer style) for a given raster layer
The JMap layer id
the initial transparency value
JMap.Map.getRasterLayerTransparency
Returns the transparency for a given raster layer
The JMap layer id
the current transparency value
JMap.Map.getRenderedFeatures
Returns rendered geojson features for the specified Jmap layer. Features that are not rendered (i.e. filtered by MapBox) are not returned
If the JMap layer is not visible, no features are returned.
MapBox splits geometries along tiles internally, meaning for instance that a polygon feature that crosses many tiles will be returned as multiple polygon pieces (sharing all properties of the original source features). By default, getRenderedFeatures will only return one of those pieces (a random one). If you pass a JGetRenderedFeaturesParams with keepAllTiles = true, all feature pieces will be returned by getRenderedFeatures.
The JMap layer id
You can pass a location, a boundary box, or a circle (radius in km) or a JGetRenderedFeaturesParams. Will returns only features that intersect.
A features array
JMap.Map.getRenderedFeaturesAttributeValues
Returns rendered features attributes for the layer.
The result is an array of object, one object for each feature. Each object contains all feature's attributes, plus another one that is called "featureId" and contains the feature id.
The JMap layer id
You can pass a location, a boundary box, or a circle (radius in km). Will returns only features that intersect.
An object array
JMap.Map.getRenderedJMapLayerIds
Returns the ids of the layers that are displayed on the map.
Mapbox doesn't support all layer types defined on JMap Server.
This function returns all layers ids that are managed by the map.
JMap.Map.getResolution
Returns the screen resolution, depending on screen DPI, latitude, and zoom level.
if params is passed will use the given values for latitude (center of the map) and zoom, else use map current ones.
Note: screen DPI is fixed.
if passed will use the given values for latitude and zoom, else use map current values
JMap.Map.getRotation
Returns the current map rotation angle.
JMap.Map.getScale
Returns the map scale, depending on screen DPI, latitude, and zoom level.
if params is passed will use the given values for latitude (center of the map) and zoom, else use map current ones.
Note: screen DPI is fixed.
if passed will use the given values for latitude and zoom, else use map current values
JMap.Map.getScaleControlPosition
Returns the current scale control position on the map.
JMap.Map.getScaleDenominator
Returns the map scale denominator, depending on screen DPI, latitude, and zoom level.
For instance if the scale is "1 : 12959346", the denominator is the number 12959346.
if params is passed will use the given values for latitude (center of the map) and zoom, else use map current ones.
Note: screen DPI is fixed.
if passed will use the given values for latitude and zoom, else use map current values
JMap.Map.getSourceFeatures
Returns geojson features for the specified JMap layer whether or not they are currently rendered by MapBox (i.e. whether or not they are filtered on screen)
If the JMap layer is not visible, no features are returned.
MapBox splits geometries along tiles internally, meaning for instance that a polygon feature that crosses many tiles will be returned as multiple polygon pieces (sharing all properties of the original source features). By default, getSourceFeatures will only return one of those pieces (a random one). If you pass a JGetSourceFeaturesParams with keepAllTiles = true, all feature pieces will be returned by getSourceFeatures. If you pass a JGetSourceFeaturesParams with keepAllTiles = false (or if keepAllTiles is not specified), and if a viewport is specified in the JGetSourceFeaturesParams, the sole feature piece returned is garanteed to be included in the viewport.
The JMap layer id
an optional JGetSourceFeaturesParams object
JMap.Map.getZoom
Returns the current map zoom.
JMap.Map.getZoomFromScale
returns the zoom corresponding to the given scale.
must be greater than 0
must be greater than 0
JMap.Map.isLayerRendered
Returns true if layer is visible on the map.
To be true the layer visibility property has to be true, and the current map scale between the layer min and max scale.
JMap.Map.isMapCreated
Returns true if the map has been created.
JMap.Map.isMapInfoControlExpanded
Returns true if the Map Info control is expanded.
JMap.Map.isMapInfoControlVisible
Returns true if the Map Info control is visible on the map.
JMap.Map.isMapLoaded
Returns true if the map has been loaded and is ready.
JMap.Map.isMapRotationControlVisible
Returns true if the Map Rotation control is visible on the map.
JMap.Map.isNavigationHistoryControlVisible
Returns true if the Navigation History control is visible on the map.
JMap.Map.isPixelRatioCurrentlyValid
Returns true if the pixel ratio/map size
combination is currently valid, false otherwise.
The pixel ratio to test
JMap.Map.isScaleControlVisible
Returns true if the scale control panel is visible on the map.
JMap.Map.navigateTo
Navigate to a location on the map (animated)
JMap.Map.openModificationPopupForCenter
Opens a popup in order to change the current map center.
JMap.Map.openModificationPopupForScale
Opens a popup in order to change the current map scale.
JMap.Map.panAndZoomTo
Move and zoom (or unzoom) the map (animated)
The location where the map will be centered
The zoom level to apply
animation, zoom padding, stop event, etc ...
JMap.Map.panTo
Move and center the map to the location (animated)
The location where the map will be centered
if true will prevent JMap events to be fired
JMap.Map.refreshLayerById
This method only works with vector layers that are not served via vector tiles
Refreshes the specified layer data on the Map. Can be called for instance after a feature has been added, deleted, or modified in the layer content server-side
The JMap layer id
JMap.Map.resetRasterLayerTransparency
Resets the raster layer transparency to its initial value as defined on the server
The JMap layer id
the initial transparency value
JMap.Map.setBearing
Set the bearing on the map.
the new degree of the bearing between -360 to 360
JMap.Map.setDefaultZoomOptions
Set zoom default values in JMap Core.
This default values will be used in all methods that use zoom options.
If zoom options are passed in methods, this default values will be overriden by passed values.
If no object is passed, default values are reset with JMap Core default values.
animation, paddings, and maxZoom
JMap.Map.setDistanceUnit
Set the distance unit, for the current project.
Save this preference in local storage.
the distance unit
JMap.Map.setMapInfoControlExpansion
Changes the Map Info control visibility on the map.
true to expand the control, false to minimise
JMap.Map.setMapInfoControlVisibility
Changes the Map Info control visibility on the map.
true to display the Map Info control, false to hide
JMap.Map.setMapRotationControlVisibility
Changes the Map Rotation control visibility on the map.
true to display the Map Rotation control, false to hide
JMap.Map.setMouseCursor
Set the map mouse cursor.
If cursor is an empty string will unset the cursor (the mapbox default will be used).
the mouse cursor
JMap.Map.setNavigationHistoryControlVisibility
Changes the Navigation History control visibility on the map.
true to display the Navigation History control, false to hide
JMap.Map.setPitch
Set the pitch on the map
te new value of the pitch between 0 to 60
JMap.Map.setRasterLayerTransparency
Sets the transparency for a given raster layer
The JMap layer id
the new layer transparency between 0 and 1
JMap.Map.setRotation
Set the rotation on the map.
the new degree of the rotation between -360 to 360
JMap.Map.setScale
Zooms or unzooms the map to reach the given map scale
must be greater than 0
animation, zoom padding, stop event, etc ...
JMap.Map.setScaleControlPosition
Changes the scale control position on the map.
the position on the map where to display the scale control.
JMap.Map.setScaleControlUnits
Changes the scale control units.
possible values : "imperial", "metric", or "nautical"
JMap.Map.setScaleControlVisibility
Changes the scale control panel visibility on the map.
true to display the scale control, false to hide
the position on the map where to display the scale control.
JMap.Map.undoLastNavigationStep
Step back in the navigation history recorded in the current map session
Will apply the necessary pan, zoom, bearing and pitch to get back to the last Map view. Maximum number of recorded steps is 64 (older steps get erased)
The last JMapNavigationStep, or undefined if the stack is not rewindable anymore
JMap.Map.zoomTo
Zoom or unzoom the map (animated)
The zoom level to apply
animation, zoom padding, stop event, etc ...
JMap.Map.zoomToRect
Zoom or unzoom to fit exactly the boundary box (animated)
The boundary box to fit
animation, zoom padding, stop event, etc ...
JMap.Map
This section contains map related methods.