Class: MapLibreMap

bemap.MapLibreMap()

Map implementation using MapLibre GL JS.

Constructor

new MapLibreMap()

Source:

Extends

Members

(protected) _zoomControlVisible

Whether the zoom (+/-) control is currently visible. Initialised from the resolved `zoomControl` option (default OFF — opt-in) and flipped at runtime by `setZoomControl()`. Kept in sync so `getZoomControl()` is accurate before any runtime toggle.
Inherited From:
Source:

(protected) callback

Inherited From:
Source:

(protected) ctx

Inherited From:
Source:

(protected) events

Inherited From:
Source:

(protected) layers

Inherited From:
Source:

(protected) native

Overrides:
Source:

Methods

(static) _normalizeBounds()

Normalize a bounds-shaped input into MapLibre's `[[west, south], [east, north]]`. Accepts MapLibre's own forms (passthrough), Leaflet LatLngBounds (getSouthWest/getNorthEast → {lat,lng}), bemap.BoundingBox ({minLon,minLat,maxLon,maxLat}), and `[west,south,east,north]` flat arrays. Returns the original value when it can't be classified — let MapLibre throw its own error rather than swallow a genuinely bad input.
Source:

_distToSegmentPx()

Distance from point P to segment AB (in pixels).
Source:

(protected) _fireError(err)

Fire an error onto the map's error channel(s). Used by the warn-and-no-op fallback and by the new auth/tile/cache error paths.
Parameters:
Name Type Description
err bemap.Error
Since:
  • 2.0.0
Inherited From:
Source:

_insertVertexOnEdge()

Insert a vertex on the nearest polygon edge to the click point.
Source:

(protected) _notSupportedByEngine(methodName) → {bemap.Map}

Report that the ACTIVE engine does not implement `methodName`, then no-op. The base class is a hand-maintained stub list, and it was only half populated (BEMAP-1898 audit). The same defect — an engine not implementing an overlay method — therefore failed two different ways: silently (`return this` for the names that were listed) or with `TypeError: … is not a function` (for the ones that were not). Neither told the developer anything useful, and the silent half is how several Leaflet gaps shipped unnoticed. Every previously-absent name now lands here: one console.warn per method per map, plus a `bemap.Error` on the map's error channel, then a harmless no-op. A TypeError becomes a visible warning; a silent nothing becomes a visible warning. Nothing that already worked changes.
Parameters:
Name Type Description
methodName String
Since:
  • 2.0.2
Inherited From:
Source:
Returns:
this
Type
bemap.Map

_rebuildVertexHandles()

Rebuild all vertex handle markers for a polygon being edited.
Source:

_refreshClusterVisibility()

Show/hide original DOM markers based on cluster state. Clustered markers are hidden, unclustered are shown. Cluster bubbles (circles with count) are created as separate DOM elements.
Source:

(protected) _requiresGlobe()

Emit a one-time `info`-level error on the map's error channel when a `setLight` / `setSky` / etc. is called on a non-globe projection where the effect won't be visible. NOT auto-enabling globe — too surprising for a public API. The customer's error subscriber sees the hint; dev console gets a one-time `console.info`.
Since:
  • 2.0.0
Inherited From:
Source:

_setupTilesAuth()

Legacy auth path for the `opts.tiles` + `opts.tilesToken` usage shape. **Deprecated** in v2.0 — prefer `ctx.tilesHost` + `bemap.TilesAuth` (the v2 path uses MapLibre's `transformRequest` instead of patching the global `window.fetch`). Kept callable for backwards compatibility.
Deprecated:
  • Since 2.0.0. Use `ctx.tilesHost` instead.
Source:

(protected) _subscribeErrorChannel(eventType, callback) → {Boolean}

Wire `on('error' | 'error:auth' | 'error:network' | 'error:maplibre-only')` through to the error channel, and report whether it did. The class doc for `_onError` has always claimed "the library version of `on()` calls this when the event name starts with 'error'" — but the base `on()` is an abstract `return new bemap.Listener()`, and all three engines override it and route straight to `_onFeature` / the native map. So the DOCUMENTED way to observe auth, tile and network failures silently subscribed to nothing on every engine (BEMAP-1898 audit). Deliberately ADDITIVE: each engine calls this first and then continues with whatever it did before, so a consumer relying on an engine's native `'error'` event (MapLibre fires one) keeps receiving it — it now simply also receives the `bemap.Error` objects that `_fireError` produces.
Parameters:
Name Type Description
eventType String
callback function
Since:
  • 2.0.2
Inherited From:
Source:
Returns:
true when the error channel was subscribed
Type
Boolean

_updateClusterSource()

Create or update the MapLibre cluster source for a ClusterLayer. Strategy: GeoJSON cluster source determines which points are clustered. Original DOM markers are shown/hidden based on cluster state. Cluster bubbles are DOM elements with Leaflet CSS classes.
Source:

_updatePolygonSource()

Update polygon GeoJSON source from coordinates array.
Source:

_whenStyleReady()

Run a callback when the map style is ready. If the style is already loaded, executes immediately; otherwise waits for the 'load' event with a safety timeout fallback.
Source:

add3DBuildings()

BeNomad BeMap JavaScript API - MapLibre v5 - 3D Buildings Usage: map.add3DBuildings({ sourceId: 'openmaptiles', sourceLayer: 'building', heightProperty: 'render_height', color: '#ddd', opacity: 0.8, minZoom: 14 });
Overrides:
Source:

addCircle(circle, options) → {bemap.Map}

Add circle to the map.
Parameters:
Name Type Description
circle bemap.Circle
options object
Overrides:
Source:
Returns:
this
Type
bemap.Map

addClusterPoints()

BeNomad BeMap JavaScript API - MapLibre v5 - Clustering Enhances ClusterLayer support for MapLibre with native GeoJSON clustering. Usage: var points = [ new bemap.Coordinate(2.35, 48.85), new bemap.Coordinate(7.26, 43.71), // ... hundreds/thousands of points ]; var clusterLayer = new bemap.ClusterLayer({ name: 'stations', distance: 50, // cluster radius in pixels style: new bemap.clusterStyle({ color: new bemap.Color(0, 150, 255, 1), borderColor: new bemap.Color(255, 255, 255, 1), textColor: new bemap.Color(255, 255, 255, 1), icon: new bemap.Icon({ src: 'marker.svg' }) }) }); map.addLayer(clusterLayer); map.addClusterPoints(clusterLayer, points, { properties: [...] });
Source:

addDrawControl(options) → {bemap.Map}

Add a drawing toolbar to the map.
Parameters:
Name Type Description
options Object See below.
Properties
Name Type Description
polygon boolean Enable polygon drawing (default: true).
polyline boolean Enable polyline drawing (default: false).
rectangle boolean Enable rectangle drawing (default: false).
circle boolean Enable circle drawing (default: false).
marker boolean Enable marker drawing (default: false).
position String Toolbar position: 'topright','topleft','bottomright','bottomleft' (default: 'topright').
onDrawEnd function Callback when a shape is drawn.
Inherited From:
Source:
Returns:
this
Type
bemap.Map

addGeoJsonSource(id, data) → {bemap.Map}

Add a GeoJSON data source. MapLibre only.
Parameters:
Name Type Description
id string Source identifier.
data object GeoJSON data.
Overrides:
Source:
Returns:
this
Type
bemap.Map

addHeatmap()

BeNomad BeMap JavaScript API - MapLibre v5 - Heatmap Usage: var heatmap = new bemap.HeatmapLayer({ name: 'earthquakes', points: [ { lon: 2.35, lat: 48.85, weight: 5 }, { lon: 7.26, lat: 43.71, weight: 3 } ], radius: 25, intensity: 1.5, colors: ['rgba(0,0,255,0)', 'royalblue', 'cyan', 'lime', 'yellow', 'red'] }); map.addHeatmap(heatmap);
Source:

addImage(id, image) → {bemap.Map}

Register a custom image for use in symbol layers. MapLibre only.
Parameters:
Name Type Description
id string Image identifier.
image object Image data.
Overrides:
Source:
Returns:
this
Type
bemap.Map

addLayer(layer, options) → {bemap.Map}

Add a layer to the map
Parameters:
Name Type Description
layer bemap.Layer
options object
Overrides:
Source:
Returns:
this
Type
bemap.Map

addMarker()

BeNomad BeMap JavaScript API - MapLibre v5 - Marker
Overrides:
Source:

(abstract) addMultiMarker(multipoint, options) → {bemap.Map}

Add a multipoint to the layer
Parameters:
Name Type Description
multipoint bemap.MultiPoint
options object
Overrides:
Source:
Returns:
this
Type
bemap.Map

addPolygon()

BeNomad BeMap JavaScript API - MapLibre v5 - Polygon
Overrides:
Source:

addPolyline()

BeNomad BeMap JavaScript API - MapLibre v5 - Polyline
Overrides:
Source:

addPopup()

BeNomad BeMap JavaScript API - MapLibre v5 - Popup
Overrides:
Source:

animateAlongRoute()

BeNomad BeMap JavaScript API - MapLibre v5 - Animation Usage: // First add a GeoJSON source for the animated point map.addGeoJsonSource('moving-point', { type: 'Feature', geometry: { type: 'Point', coordinates: [0, 0] } }); // Then animate along a route var controller = map.animateAlongRoute({ sourceId: 'moving-point', coordinates: [[2.35, 48.85], [7.26, 43.71], [5.37, 43.29]], speed: 0.005, loop: true, onUpdate: function(pos) { console.log(pos.lon, pos.lat); }, onComplete: function() { console.log('Done!'); } }); // Control the animation controller.stop(); controller.resume();
Source:

animateCameraOrbit(options) → {object}

Animate camera rotation around a point. MapLibre only.
Parameters:
Name Type Description
options object
Properties
Name Type Description
center Array [lon, lat] rotation center.
zoom number Zoom level (default: current).
pitch number Pitch angle (default: 60).
speed number Degrees per frame (default: 0.3).
Source:
Returns:
Controller { stop, resume }
Type
object

animateLine(options) → {object}

Animate drawing a line progressively. MapLibre only.
Parameters:
Name Type Description
options object
Properties
Name Type Description
sourceId string GeoJSON source ID (must exist).
coordinates Array Array of [lon, lat] for the full line.
speed number Points per frame (default: 1).
Source:
Returns:
Controller { stop, resume, reset }
Type
object

animatePulse(options) → {object}

Animate pulsing circle effect. MapLibre only. Creates a pulsing circle at a coordinate using paint property animation.
Parameters:
Name Type Description
options object
Properties
Name Type Description
center Array [lon, lat].
color string Circle color (default: '#e74c3c').
maxRadius number Max radius in pixels (default: 30).
speed number Pulse speed (default: 0.05).
Source:
Returns:
Controller { stop, remove }
Type
object

backgroundLayers(geoservers, optionsopt) → {bemap.MapLibreMap}

No-op, kept so `.backgroundLayers(list).switchBackgroundLayer(name)` stays valid cross-engine. MapLibre needs no pre-declared layers.
Parameters:
Name Type Attributes Description
geoservers Array.<String> Ignored.
options Object <optional>
Ignored.
Overrides:
Source:
Returns:
Return this.
Type
bemap.MapLibreMap

(abstract) buildIcon(icon, options) → {bemap.Map}

Build icon resource.
Parameters:
Name Type Description
icon bemap.Icon
options object
Overrides:
Source:
Returns:
this
Type
bemap.Map

(abstract) buildLineStyle(LineStyle, options) → {bemap.Map}

Build LineStyle resource.
Parameters:
Name Type Description
LineStyle bemap.LineStyle
options object
Overrides:
Source:
Returns:
this
Type
bemap.Map

clearAllEffects() → {bemap.Map}

Tear down every registered effect. Invokes each teardown in registration order, swallowing errors per-teardown so one failure doesn't block the rest. Each teardown is expected to call `_unregisterEffect` itself via the matching `remove*`/`stop*` path; the registry is cleared at the end regardless.
Since:
  • 2.0.0
Inherited From:
Source:
Returns:
Type
bemap.Map

(abstract) clearLayer(layer) → {bemap.Map}

Remove all objects from a layer.
Parameters:
Name Type Description
layer bemap.Layer the layer object to clear.
Overrides:
Source:
Returns:
this
Type
bemap.Map

clearPopup() → {bemap.MapLibreMap}

Remove all the popups THIS map owns. Used to be `document.querySelectorAll('.maplibregl-popup')` + `Element.remove()`, which had three faults (BEMAP-1898 audit): • document-wide — it deleted popups belonging to other bemap maps on the page, and any `maplibregl.Popup` the host application had created itself; • it removed the DOM node instead of calling the popup's own `remove()`, so MapLibre never detached its map listeners — each open/clear cycle leaked a move + click + remove handler set; • the bemap.Popup models were left reporting `isVisible() === true`.
Overrides:
Source:
Returns:
this
Type
bemap.MapLibreMap

defaultLayers()

Add default layers. If no custom style was provided, adds WMS background from the BeMap server (same as OlMap). Always adds overlay layers.
Overrides:
Source:

defaultOverlayLayers(options) → {bemap.Map}

Add default overlay layers, like dedicated for markers or polyline, etc.
Parameters:
Name Type Description
options object
Properties
Name Type Description
markerAsCluster boolean
Inherited From:
Source:
Returns:
this
Type
bemap.Map

(protected) draggableMarker(marker, callback, options) → {bemap.Listener}

Define the draggable capability for bemap.Marker.
Parameters:
Name Type Description
marker bemap.Marker bemap object.
callback function Function will be called when the specified eventType is occur.
options object Options.
Properties
Name Type Description
layerFilter bemap.Layer set the bemap layer used as filter.
Overrides:
Source:
Returns:
bemap.listener.
Type
bemap.Listener

(protected) draggableMarkers(callback, options) → {bemap.Listener}

Define the draggable capability for all bemap.Marker.
Parameters:
Name Type Description
callback function Function will be called when the specified eventType is occur.
options object Options.
Properties
Name Type Description
layerFilter bemap.Layer set the bemap layer used as filter.
Overrides:
Source:
Returns:
bemap.listener.
Type
bemap.Listener

(protected) draggableMultiMarkers(callback, options) → {bemap.Listener}

Define the draggable capability for all bemap.MultiMarkers.
Parameters:
Name Type Description
callback function Function will be called when the specified eventType is occur.
options object Options.
Properties
Name Type Description
layerFilter bemap.Layer set the bemap layer used as filter.
Overrides:
Source:
Returns:
bemap.listener.
Type
bemap.Listener

(protected) draggablePolyline(polyline, callback, options) → {bemap.Listener}

Define the draggable capability for bemap.Polyline.
Parameters:
Name Type Description
polyline bemap.Polyline bemap object.
callback function Function will be called when the specified eventType is occur.
options object Options.
Properties
Name Type Description
layerFilter bemap.Layer set the bemap layer used as filter.
Overrides:
Source:
Returns:
bemap.listener.
Type
bemap.Listener

(protected) draggablePolylines(callback, options) → {bemap.Listener}

Define the draggable capability for all bemap.Polyline.
Parameters:
Name Type Description
callback function Function will be called when the specified eventType is occur.
options object Options.
Properties
Name Type Description
layerFilter bemap.Layer set the bemap layer used as filter.
Overrides:
Source:
Returns:
bemap.listener.
Type
bemap.Listener

drawPolygon()

BeNomad BeMap JavaScript API - MapLibre v5 - Draw Interaction Manual implementation using GeoJSON sources + mouse events.
Overrides:
Source:

easeTo(options) → {bemap.Map}

Smooth animated camera transition. MapLibre only.
Parameters:
Name Type Description
options object center, zoom, pitch, bearing, duration.
Overrides:
Source:
Returns:
this
Type
bemap.Map

fetchAvailableMaps() → {Promise.<Object>}

Fetch the Worker's map config — `GET /api/maps` — resolving with `{ default, aliases, tilesets }` so an app can build a map-picker. Requires `ctx.tilesHost`; the session token is attached automatically by the TilesAuth fetch interceptor (it waits for login to complete first).
Since:
  • 2.0.0
Source:
Returns:
Type
Promise.<Object>

fetchAvailableStyles() → {Promise.<Object>}

Fetch the Worker's allow-listed styles — `GET /api/styles` — resolving with `{ styles: [...] }`. See bemap.MapLibreMap#fetchAvailableMaps.
Since:
  • 2.0.0
Source:
Returns:
Type
Promise.<Object>

fetchDefaultMap() → {Promise.<Object>}

Fetch the filename the `default` alias currently resolves to — `GET /api/default` — resolving with `{ default: ''|null }`.
Since:
  • 2.0.0
Source:
Returns:
Type
Promise.<Object>

fetchDefaultStyle() → {Promise.<Object>}

Fetch the name of the Worker's default MapLibre style — `GET /api/default-style` — resolving with `{ default: ''|null }`. This is the style applied when the developer pins none; see bemap.MapLibreMap#fetchAvailableStyles.
Since:
  • 2.0.0
Source:
Returns:
Type
Promise.<Object>

flyTo(lon, lat, zoom, options)

Fly map to new coordinate.
Parameters:
Name Type Description
lon double longitude
lat double latitude
zoom double zoom
options Object options
Overrides:
Source:

getActiveEffects() → {Array.<String>}

Names of every currently-active effect. Snapshot — does not auto- update; subscribe via `onEffectChange` for live notification.
Since:
  • 2.0.0
Inherited From:
Source:
Returns:
Type
Array.<String>

getBearing() → {number}

Get the current bearing. MapLibre only.
Overrides:
Source:
Returns:
bearing in degrees (0 if not supported).
Type
number

getBoundingBox() → {bemap.BoundingBox}

Get the limits of the map on the current zoom.
Overrides:
Source:
Returns:
the bounding box containing the limits.
Type
bemap.BoundingBox

getCenter() → {bemap.Coordinate}

Get the center of the map in bemap.Coordinate.
Overrides:
Source:
Returns:
the center of the map.
Type
bemap.Coordinate

getKeyboard()

Source:

getLayerByName(name) → {bemap.Layer}

Search the layer by name.
Parameters:
Name Type Description
name String of layer.
Inherited From:
Source:
Returns:
Return the layer or null if not found.
Type
bemap.Layer

getPitch() → {number}

Get the current pitch angle. MapLibre only.
Overrides:
Source:
Returns:
pitch in degrees (0 if not supported).
Type
number

getRotation() → {int}

Get current rotation angle of map.
Overrides:
Source:
Returns:
-1 if not supported.
Type
int

getStyle() → {Object}

Get the current MapLibre style spec (the one resolved and applied by the library — same shape `getStyle()` would return).
Since:
  • 2.0.0
Source:
Returns:
Type
Object

getTileGateActive()

Source:

getTilesConfig() → {Object}

Return the resolved BeNomad-Tiles configuration for this map — the effective values after opts + Context + page-level defaults are merged. Useful for debugging ("what is actually in effect?"). All fields are read-only snapshots.
Since:
  • 2.0.0
Source:
Returns:
Type
Object

getZoom() → {int}

Get current zoom of map.
Overrides:
Source:
Returns:
-1 if not supported.
Type
int

getZoomControl()

Inherited From:
Source:

(abstract) isDragPan() → {boolean}

Return the satus of drag pan of map.
Parameters:
Name Type Description
options.dragPan. Object
Overrides:
Source:
Returns:
true to enable the drag pan of map, otherwise false.
Type
boolean

jumpTo(options) → {bemap.Map}

Instant camera change with pitch/bearing support. MapLibre only.
Parameters:
Name Type Description
options object center, zoom, pitch, bearing.
Overrides:
Source:
Returns:
this
Type
bemap.Map

loadBeMapTiles(options) → {bemap.MapLibreMap}

Load BeMap PMTiles vector tiles. Auto-authenticates using bemap.Context credentials. Usage: map.loadBeMapTiles(); // uses defaults + context credentials map.loadBeMapTiles({ url: 'https://mptiles-api.benomad.net', tilesFile: 'Europe.pmtiles', style: 'style_liberty.json' }); map.loadBeMapTiles({ token: 'existing-jwt' }); // skip login **NOT SUPPORTED behind a `proxy`** (EVMOVE-307): this legacy path sends `Authorization: Basic` from the browser by design, which is exactly what `ctx.proxy` exists to prevent, and it errors without credentials. Use `ctx.tilesHost` (+ `ctx.proxy`) instead — no house app calls this helper.
Parameters:
Name Type Description
options Object
Properties
Name Type Description
url String Tiles API base URL — REQUIRED unless `ctx.tilesHost` is set.
tilesFile String PMTiles map alias or tileset name (default: 'default' — the Worker chooses).
style String Style name (default: 'openfreemap_graylevel.json').
token String JWT token — if provided, skips login.
login String Override context login.
password String Override context password.
onSuccess function callback(map, token).
onError function callback(errorMessage).
Deprecated:
  • Since 2.0.0 — prefer `ctx.tilesHost` on the Context, which routes through `bemap.TilesAuth` + the fetch interceptor instead of a one-shot login + setStyle.
Source:
Returns:
this
Type
bemap.MapLibreMap

loadPMTiles(layer, callback) → {bemap.MapLibreMap}

Load PMTiles vector tiles with optional style and authentication. Registers the pmtiles:// protocol, sets up token injection, loads style, and applies it to the map. Requires pmtiles.js library.
Parameters:
Name Type Description
layer bemap.PMTilesLayer PMTilesLayer with url, style, token, etc.
callback function Called when loading is complete (optional).
Source:
Returns:
this
Type
bemap.MapLibreMap

(abstract) move(lon, lat, zoom, options) → {bemap.Map}

Move map to new coordinate.
Parameters:
Name Type Description
lon double Longitude in degres decimal (WGS84).
lat double Latitude in degres decimal (WGS84).
zoom int Zoom level (optional).
options Object Options (optional).
Overrides:
Source:
Returns:
this
Type
bemap.Map

moveToBoundingBox(boundingBox, options) → {bemap.Map}

Set the center and the zoom of the map to fit the bounding box.
Parameters:
Name Type Description
boundingBox bemap.BoundingBox the bounding box to fit.
options Object Options (optional).
Overrides:
Source:
Returns:
this.
Type
bemap.Map

(abstract) moveToLayerData(layer, options) → {bemap.Map}

Move map and zoom on data contains in layers.
Parameters:
Name Type Description
layer bemap.Layer Layer.
options Object Options (optional).
Overrides:
Source:
Returns:
this
Type
bemap.Map

(abstract) on(eventType, callback, options) → {bemap.Listener}

Set the listner when an specified eventType occur on bemap.Map.
Parameters:
Name Type Description
eventType bemap.Map.EventType Event type.
callback function Function will be called when the specified eventType is occur.
options object options.
Overrides:
Source:
Returns:
this.
Type
bemap.Listener

onEffectChange()

Subscribe to active-effect changes. Fires `{name, active}` whenever an effect is registered (`active: true`) or torn down (`active: false`). The dashboard's active-effects bar consumes this.
Since:
  • 2.0.0
Inherited From:
Source:

onGetFeatureInfo(layer, options) → {bemap.Listener}

Set get feature info call back.
Parameters:
Name Type Description
layer bemap.Layer set the bemap layer.
options object options.
Properties
Name Type Description
beforeCallback function callback called at data reception and before display the popup.
afterCallback function callback called after display the popup.
Inherited From:
Source:
Returns:
listener;
Type
bemap.Listener

(abstract) onMarker(marker, eventType, callback, options) → {bemap.Listener}

Set the listner when an specified eventType occur on bemap.Marker.
Parameters:
Name Type Description
marker bemap.Marker
eventType bemap.Map.EventType Event type.
callback function Function will be called when the specified eventType is occur.
options object options.
Overrides:
Source:
Returns:
this.
Type
bemap.Listener

(abstract) onMarkers(eventType, callback, options) → {bemap.Listener}

Set the listner when an specified eventType occur on all bemap.Marker.
Parameters:
Name Type Description
eventType bemap.Map.EventType Event type.
callback function Function will be called when the specified eventType is occur.
options object options.
Overrides:
Source:
Returns:
this.
Type
bemap.Listener

(abstract) onMultiMarkers(eventType, callback, options) → {bemap.Listener}

Set the listner when an specified eventType occur on all bemap.MultiMarker.
Parameters:
Name Type Description
eventType bemap.Map.EventType Event type.
callback function Function will be called when the specified eventType is occur.
options object options.
Overrides:
Source:
Returns:
this.
Type
bemap.Listener

(abstract) onPolyline(polyline, eventType, callback, options) → {bemap.Listener}

Set the listner when an specified eventType occur on bemap.Polyline.
Parameters:
Name Type Description
polyline bemap.Polyline
eventType bemap.Map.EventType Event type.
callback function Function will be called when the specified eventType is occur.
options object options.
Overrides:
Source:
Returns:
this.
Type
bemap.Listener

(abstract) onPolylines(eventType, callback, options) → {bemap.Listener}

Set the listner when an specified eventType occur on all bemap.Polyline.
Parameters:
Name Type Description
eventType bemap.Map.EventType Event type.
callback function Function will be called when the specified eventType is occur.
options object options.
Overrides:
Source:
Returns:
this.
Type
bemap.Listener

queryRenderedFeatures(point, options) → {Array}

Query rendered features at a point or in a box. MapLibre only.
Parameters:
Name Type Description
point object Screen point or bounding box.
options object Query options (layers, filter).
Overrides:
Source:
Returns:
Array of feature objects.
Type
Array

(abstract) refresh(options) → {bemap.Map}

Refresh map.
Parameters:
Name Type Description
options Object Options (optional).
Overrides:
Source:
Returns:
this
Type
bemap.Map

refreshLayer(layer) → {bemap.Map}

Refresh all objects from a layer.
Parameters:
Name Type Description
layer bemap.Layer the layer object to refresh.
Overrides:
Source:
Returns:
this
Type
bemap.Map

removeCircle(circle) → {bemap.Map}

Remove circle from the map.
Parameters:
Name Type Description
circle bemap.Circle
Overrides:
Source:
Returns:
this
Type
bemap.Map

removeImage(id) → {bemap.Map}

Remove a registered image. MapLibre only.
Parameters:
Name Type Description
id string Image identifier.
Overrides:
Source:
Returns:
this
Type
bemap.Map

(abstract) removeLayer(layer) → {bemap.Map}

Remove a layer from the map.
Parameters:
Name Type Description
layer bemap.Layer layer to remove from the map.
Overrides:
Source:
Returns:
this.
Type
bemap.Map

(abstract) removeMarker(marker) → {bemap.Map}

Remove a marker from the layer
Parameters:
Name Type Description
marker bemap.Marker
Overrides:
Source:
Returns:
this
Type
bemap.Map

(abstract) removeMultimarker(multimarker) → {bemap.Map}

Remove a multimarker from the layer
Parameters:
Name Type Description
multimarker bemap.MultiMarker
Overrides:
Source:
Returns:
this
Type
bemap.Map

removePolygon(polygon) → {bemap.Map}

Remove polygon from the map.
Parameters:
Name Type Description
polygon bemap.Polygon
Overrides:
Source:
Returns:
this
Type
bemap.Map

(abstract) removePolyline(polyline) → {bemap.Map}

Remove a polyline from the layer
Parameters:
Name Type Description
polyline bemap.Polyline
Overrides:
Source:
Returns:
this
Type
bemap.Map

removePopup(popup) → {bemap.Map}

Remove a popup from the map.
Parameters:
Name Type Description
popup bemap.Popup the popup to remove from the map.
Overrides:
Source:
Returns:
this;
Type
bemap.Map

removeTerrain() → {bemap.Map}

Disable 3D terrain. MapLibre only.
Overrides:
Source:
Returns:
this
Type
bemap.Map

rotation()

Overrides:
Deprecated:
  • Since 2.0 — use setBearing(deg) for a cross-engine API. rotation() stays callable but emits a one-time warn so customer code can migrate without surprises.
Source:

setBearing(bearing) → {bemap.Map}

Set the bearing (compass rotation) of the map. MapLibre only.
Parameters:
Name Type Description
bearing number Bearing in degrees (0-360).
Overrides:
Source:
Returns:
this
Type
bemap.Map

setCoordinatePopup(popup, coordinate, options) → {bemap.Map}

Set the coordinate of the popup.
Parameters:
Name Type Description
popup bemap.Popup the popup of wich to set the coordinate.
coordinate bemap.Coordinate the new coordinate.
options object Options.
Properties
Name Type Description
panningMap bemap.Layer enable the map panning animation. move map from the current position to the popup anchor at the center of map.
Overrides:
Source:
Returns:
this.
Type
bemap.Map

(abstract) setDragPan(active) → {bemap.Map}

Enable or disable the drag pan of map.
Parameters:
Name Type Description
active boolean true to enable the drag pan of map, otherwise false.
options.dragPan. Object
Overrides:
Source:
Returns:
this
Type
bemap.Map

setKeyboard(enabled) → {bemap.MapLibreMap}

Toggle keyboard navigation (arrow-pan + `=`/`-` zoom + `Shift+arrow` rotate/tilt — MapLibre's `KeyboardHandler` is one bundle) at runtime.
Parameters:
Name Type Description
enabled Boolean
Source:
Returns:
Type
bemap.MapLibreMap

setLight(options) → {bemap.Map}

Set 3D light position and properties. MapLibre only.
Parameters:
Name Type Description
options object Light options (position, color, intensity, anchor).
Overrides:
Source:
Returns:
this
Type
bemap.Map

setPitch(pitch) → {bemap.Map}

Set the pitch (tilt) angle of the map in degrees. MapLibre only.
Parameters:
Name Type Description
pitch number Pitch angle (0-85).
Overrides:
Source:
Returns:
this
Type
bemap.Map

setProjection(type) → {bemap.Map}

Set map projection ('mercator' or 'globe'). MapLibre only.
Parameters:
Name Type Description
type string projection type.
Overrides:
Source:
Returns:
this
Type
bemap.Map

setSky(options) → {bemap.Map}

Set sky/atmosphere effects. MapLibre only.
Parameters:
Name Type Description
options object sky options.
Overrides:
Source:
Returns:
this
Type
bemap.Map

setStyle()

Replace `bemap.Map.prototype.setStyle` for MapLibre — accepts either a URL or an inline style object, fetches + resolves placeholders via `bemap.TilesStyle`, calls native `setStyle`, and **replays the overlay catalogue** so user markers / polylines / polygons survive the swap.
Since:
  • 2.0.0
Overrides:
Source:

setTerrain(options) → {bemap.Map}

Enable 3D terrain rendering. MapLibre only.
Parameters:
Name Type Description
options object terrain options (source, exaggeration).
Overrides:
Source:
Returns:
this
Type
bemap.Map

setTileGateActive(active) → {bemap.MapLibreMap}

Live-toggle the resilience gate (concurrency cap + timeout + retry) WITHOUT a reload — the slice source reads it per request. Fires `onTileGateChange` and any `'tilegatechange'` listeners. This is the SDK-supported way to build a diagnostic on/off button (the demo/bemaputnik call this).
Parameters:
Name Type Description
active Boolean
Since:
  • 2.0.0
Source:
Returns:
this
Type
bemap.MapLibreMap

setTilesSliceMode(mode) → {bemap.MapLibreMap}

Set the tile fetch mode (`'200'` | `'range'`) for archives wired AFTER this call. Archives already registered keep their source; call before loading a style, or reload the style, for a live A/B. Returns this.
Parameters:
Name Type Description
mode String `'200'` or `'range'` (`'206'` accepted as an alias for `'range'`)
Since:
  • 2.0.0
Source:
Returns:
this
Type
bemap.MapLibreMap

setVisiblePopup(popup, visible) → {bemap.Popup}

Set the visiblility of the popup.
Parameters:
Name Type Description
popup bemap.Popup the popup.
visible Boolean true for visible and false for hidden.
Overrides:
Source:
Returns:
this.
Type
bemap.Popup

setZoomControl(enabled) → {bemap.Map}

Show or hide the engine's native zoom (+/-) buttons at runtime. Uniform across Leaflet, OpenLayers and MapLibre — toggles a class on the map container so the engine-specific selectors all hit at once.
Parameters:
Name Type Description
enabled Boolean
Since:
  • 1.5.0
Inherited From:
Source:
Returns:
this
Type
bemap.Map

spinGlobe(options) → {object}

Spin the globe continuously. MapLibre only.
Parameters:
Name Type Description
options object
Properties
Name Type Description
speed number Degrees per frame (default: 0.3).
Source:
Returns:
Controller { stop, resume }
Type
object

switchBackgroundLayer(geoserver) → {bemap.MapLibreMap}

Point the basemap at another geoserver's tiles, in place. Leaflet and OpenLayers toggle pre-created raster layers; MapLibre re-resolves the archive and re-applies the current style, so the map instance and its overlays survive. Was a stub, so a geoserver selector had no effect on any MapLibre map (BEMAP-1905). `setStyle` does the work — re-registers the slice source, re-resolves the placeholders, replays the overlays. The name is passed EXPLICITLY so it outranks `ctx.tilesFile`, and `_tilesFileExplicit` is cleared so a provider with no archive is treated as "no vector map" rather than a misconfiguration. Selecting a provider that HAS one restores the basemap.
Parameters:
Name Type Description
geoserver String Geoserver / tiles name, e.g. `'osm'`.
Since:
  • 2.0.4
Overrides:
Source:
Returns:
Return this.
Type
bemap.MapLibreMap

updateGeoJsonSource(id, data) → {bemap.Map}

Update an existing GeoJSON source data. MapLibre only.
Parameters:
Name Type Description
id string Source identifier.
data object New GeoJSON data.
Overrides:
Source:
Returns:
this
Type
bemap.Map

(abstract) visibleLayer(layer) → {bemap.Map}

Set the visibility of the layer.
Parameters:
Name Type Description
layer bemap.Layer the layer of wich to set the visibility.
visible. boolean
Overrides:
Source:
Returns:
return this.
Type
bemap.Map

zIndexLayer(layer, zIndex) → {bemap.MapLibreMap}

Re-stack a layer relative to the others. MapLibre keeps layers in an ordered array on the native style; later entries paint on top of earlier ones. To raise a bemap Layer, walk its tracked sub-layers (`geoJsonIds`) and `moveLayer` each to the top. To lower, move them before the first non-base layer. HTML markers (DOM elements, no style-array entry) get a matching CSS `z-index` so DOM stacking follows the same intent. Threshold: zIndex ≥ 50 counts as "on top", everything else "behind".
Parameters:
Name Type Description
layer bemap.Layer
zIndex Number
Overrides:
Source:
Returns:
this
Type
bemap.MapLibreMap

(abstract) zoom(zoom, options) → {bemap.Map}

Zoom on map, set new zoom level.
Parameters:
Name Type Description
zoom int Zoom level (optional).
options Object Options (optional).
Overrides:
Source:
Returns:
this
Type
bemap.Map