Constructor
new LeafletMap(context, target)
Parameters:
| Name | Type | Description |
|---|---|---|
context |
bemap.Context | BeMap-JS-API Context. |
target |
string | HTML element. |
options. |
Extends
Members
(static) EVENT_ALIAS
Leaflet's native names for the three pointer events whose bemap constant has
no Leaflet equivalent — Leaflet fires `mouseup`/`mousedown`/`mouseover`, never
`pointerup`/`pointerdown`/`pointermove`.
This used to be done by REWRITING `bemap.Map.EventType` inside the LeafletMap
constructor. That enum is shared by all three engines, so on a page holding
more than one map (the examples dashboard offers all three) whichever engine
was constructed last redefined the constants for the others — and constructing
a LeafletMap leaked into unrelated code, which is why Leaflet could not be
loaded in the test harness at all. Translating per call fixes both.
- Since:
- 2.0.2
- Source:
(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:
(protected) target
Methods
_clickDraw()
Click-based drawing fallback (when L.Draw is not loaded).
_colorToHex()
Helper: convert bemap.Color to hex string.
(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:
(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
(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:
(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
add3DBuildings(options) → {bemap.Map}
Add 3D extruded buildings. MapLibre only.
Parameters:
| Name | Type | Description |
|---|---|---|
options |
object | Building configuration. |
- Inherited From:
- Source:
Returns:
this
- Type
- bemap.Map
addCircle(options) → {bemap.LeafletMap}
Add a bemap.Circle to the layer
Parameters:
| Name | Type | Description |
|---|---|---|
bemap.Circle. |
bemap.Circle | |
options |
object |
- Overrides:
- Source:
Returns:
- Type
- bemap.LeafletMap
addDrawControl(options) → {bemap.Map}
Add a drawing toolbar to the map.
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | See below.
Properties
|
- 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. |
- Inherited From:
- Source:
Returns:
this
- Type
- bemap.Map
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. |
- Inherited From:
- Source:
Returns:
this
- Type
- bemap.Map
addLayer(layer, options) → {bemap.LeafletMap}
Add a layer to the Leaflet map.
Parameters:
| Name | Type | Description |
|---|---|---|
layer |
bemap.Layer | |
options |
object |
- Overrides:
- Source:
Returns:
this
- Type
- bemap.LeafletMap
addMarker(marker, options) → {bemap.LeafletMap}
Add a marker to the layer
Parameters:
| Name | Type | Description |
|---|---|---|
marker |
bemap.Marker | |
options |
object |
- Overrides:
- Source:
Returns:
this
- Type
- bemap.LeafletMap
addMultiMarker(multimarker, options) → {bemap.LeafletMap}
Add a multimarker to the map. Leaflet has no native multi-point marker, so —
exactly like the MapLibre backend — each point is rendered as its own child
bemap.Marker (id "_"). Previously LeafletMap had NO
addMultiMarker at all, so `map.addMultiMarker(mm)` hit the base no-op and the
multimarker was silently dropped — the engines rendered different marker
counts for the same code (PMT-28). Now all three engines draw the same points.
Parameters:
| Name | Type | Description |
|---|---|---|
multimarker |
bemap.MultiMarker | |
options |
object |
- Overrides:
- Source:
Returns:
this
- Type
- bemap.LeafletMap
addPolygon(options) → {bemap.LeafletMap}
Add a bemap.Polygon to the layer
Parameters:
| Name | Type | Description |
|---|---|---|
bemap.Polygon. |
bemap.Polygon | |
options |
object |
- Overrides:
- Source:
Returns:
- Type
- bemap.LeafletMap
addPolyline(options) → {bemap.LeafletMap}
Add a bemap.Polyline to the layer
Parameters:
| Name | Type | Description |
|---|---|---|
bemap.Polyline. |
bemap.Polyline | |
options |
object |
- Overrides:
- Source:
Returns:
- Type
- bemap.LeafletMap
addPopup(popup, options) → {bemap.LeafletMap}
Add a popup to the map
Parameters:
| Name | Type | Description |
|---|---|---|
popup |
bemap.Popup | |
options |
object |
- Overrides:
- Source:
Returns:
this
- Type
- bemap.LeafletMap
backgroundLayers(geoservers) → {bemap.Map}
Create a background layer for each geoserver name.
Parameters:
| Name | Type | Description |
|---|---|---|
geoservers |
array | List of geoserver name. |
- Inherited From:
- Source:
Returns:
this
- Type
- bemap.Map
(abstract) buildIcon(icon, options) → {bemap.Map}
Build icon resource.
Parameters:
| Name | Type | Description |
|---|---|---|
icon |
bemap.Icon | |
options |
object |
- Inherited From:
- Source:
Returns:
this
- Type
- bemap.Map
(abstract) buildLineStyle(LineStyle, options) → {bemap.Map}
Build LineStyle resource.
Parameters:
| Name | Type | Description |
|---|---|---|
LineStyle |
bemap.LineStyle | |
options |
object |
- Inherited From:
- 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
clearLayer(layer) → {bemap.LeafletMap}
Remove all objects from a layer.
Parameters:
| Name | Type | Description |
|---|---|---|
layer |
bemap.Layer | the layer object to clear. |
- Overrides:
- Source:
Returns:
this
- Type
- bemap.LeafletMap
clearPopup() → {bemap.LeafletMap}
Remove all the popups from the map.
- Overrides:
- Source:
Returns:
this;
- Type
- bemap.LeafletMap
defaultLayers(options) → {bemap.Map}
Add default layers.
Parameters:
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
options |
object |
Properties
|
- Inherited From:
- Source:
Returns:
this
- Type
- bemap.Map
defaultOverlayLayers(options) → {bemap.Map}
Add default overlay layers, like dedicated for markers or polyline, etc.
Parameters:
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
options |
object |
Properties
|
- Inherited From:
- Source:
Returns:
this
- Type
- bemap.Map
(protected) draggableCircle(circle, callback, options) → {bemap.Listener}
Define the draggable capability for bemap.Circle.
Parameters:
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
circle |
bemap.Circle | bemap object. | ||||||
callback |
function | Function will be called when the specified eventType is occur. | ||||||
options |
object | Options.
Properties
|
Returns:
bemap.listener.
- Type
- bemap.Listener
(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
|
- 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
|
- Inherited From:
- 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
|
- Inherited From:
- Source:
Returns:
bemap.listener.
- Type
- bemap.Listener
draggablePolygon(polygon, callback, options) → {bemap.Listener}
Define the draggable capability for bemap.Polygon (Leaflet).
Parameters:
| Name | Type | Description |
|---|---|---|
polygon |
bemap.Polygon | |
callback |
function | |
options |
object |
Returns:
- Type
- bemap.Listener
draggablePolyline(polyline, callback, options) → {bemap.Listener}
Define the draggable capability for bemap.Polyline (Leaflet).
Parameters:
| Name | Type | Description |
|---|---|---|
polyline |
bemap.Polyline | |
callback |
function | |
options |
object |
- Overrides:
- Source:
Returns:
- 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
|
- Inherited From:
- Source:
Returns:
bemap.listener.
- Type
- bemap.Listener
drawPolygon()
BeNomad BeMap JavaScript API - Leaflet - Draw Interaction
Uses L.Draw if available, otherwise falls back to click-based drawing.
- 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
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()
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.
- Inherited From:
- 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
getZoom() → {int}
Get current zoom level of map.
- Overrides:
- Source:
Returns:
current zoom level of map.
- Type
- int
getZoomControl()
- Inherited From:
- Source:
isDragPan() → {boolean}
Return drag pan status.
- Overrides:
- Source:
Returns:
- 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
move(lon, lat, zoom, options) → {bemap.LeafletMap}
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).
Properties
|
- Overrides:
- Source:
Returns:
this
- Type
- bemap.LeafletMap
moveToBoundingBox(boundingBox) → {bemap.LeafletMap}
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. |
- Overrides:
- Source:
Returns:
this.
- Type
- bemap.LeafletMap
(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). |
- Inherited From:
- Source:
Returns:
this
- Type
- bemap.Map
on(eventType, callback, options) → {bemap.Listener}
Set the listner when an specified eventType occur on bemap.LeafletMap.
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:
listner.
- Type
- bemap.Listener
onCircle(circle, eventType, callback, options) → {bemap.Listener}
Set the listner when an specified eventType occur on bemap.Circle.
Parameters:
| Name | Type | Description |
|---|---|---|
circle |
bemap.Circle | |
eventType |
bemap.Map.EventType | Event type. |
callback |
function | Function will be called when the specified eventType is occur. |
options |
object | options. |
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
|
- Inherited From:
- Source:
Returns:
listener;
- Type
- bemap.Listener
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. |
- Inherited From:
- Source:
Returns:
this.
- Type
- bemap.Listener
onMultiMarkers(eventType, callback, options) → {bemap.Listener}
Attach a listener to every multimarker's child markers (they are ordinary
L.markers) so a click on any point fires with that child as bemapObject —
matching the MapLibre backend's onMultiMarkers behaviour.
Parameters:
| Name | Type | Description |
|---|---|---|
eventType |
bemap.Map.EventType | |
callback |
function | |
options |
object |
- Overrides:
- Source:
Returns:
- Type
- bemap.Listener
onPolygon(polygon, eventType, callback, options) → {bemap.Listener}
Set the listner when an specified eventType occur on bemap.Polygon.
Parameters:
| Name | Type | Description |
|---|---|---|
polygon |
bemap.Polygon | |
eventType |
bemap.Map.EventType | Event type. |
callback |
function | Function will be called when the specified eventType is occur. |
options |
object | options. |
Returns:
this.
- Type
- bemap.Listener
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. |
- Inherited From:
- 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). |
- Inherited From:
- Source:
Returns:
Array of feature objects.
- Type
- Array
(abstract) refresh(options) → {bemap.LeafletMap}
Refresh map.
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object | Options (optional). |
- Overrides:
- Source:
Returns:
this
- Type
- bemap.LeafletMap
refreshLayer(layer) → {bemap.LeafletMap}
Refresh all objects from a layer.
Parameters:
| Name | Type | Description |
|---|---|---|
layer |
bemap.Layer | the layer object to refresh. |
- Overrides:
- Source:
Returns:
this
- Type
- bemap.LeafletMap
removeCircle(circle)
Remove a circle from his layer.
Parameters:
| Name | Type | Description |
|---|---|---|
circle |
bemap.Circle | the circle object to remove. |
- Overrides:
- Source:
removeImage(id) → {bemap.Map}
Remove a registered image. MapLibre only.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | Image identifier. |
- Inherited From:
- Source:
Returns:
this
- Type
- bemap.Map
removeLayer(layer) → {bemap.LeafletMap}
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.LeafletMap
(protected) removeListener(listener, options) → {bemap.LeafletMap}
Remove listener.
Parameters:
| Name | Type | Description |
|---|---|---|
listener |
bemap.Listener | Function will be called when the specified eventType is occur. |
options |
object | Options. |
Returns:
this.
- Type
- bemap.LeafletMap
removeMarker(marker) → {bemap.LeafletMap}
Remove a marker from his layer.
Parameters:
| Name | Type | Description |
|---|---|---|
marker |
bemap.Marker | the marker object to remove. |
- Overrides:
- Source:
Returns:
this
- Type
- bemap.LeafletMap
removeMultimarker(multimarker) → {bemap.LeafletMap}
Remove a multimarker (and its child markers) from the map.
Parameters:
| Name | Type | Description |
|---|---|---|
multimarker |
bemap.MultiMarker |
- Overrides:
- Source:
Returns:
this
- Type
- bemap.LeafletMap
removePolygon(polygon) → {bemap.Map}
Remove polygon from the map.
Parameters:
| Name | Type | Description |
|---|---|---|
polygon |
bemap.Polygon |
- Overrides:
- Source:
Returns:
this
- Type
- bemap.Map
removePolyline(polyline)
Remove a polyline from his layer.
Parameters:
| Name | Type | Description |
|---|---|---|
polyline |
bemap.Polyline | the polyline object to remove. |
- Overrides:
- Source:
removePopup(popup) → {bemap.LeafletMap}
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.LeafletMap
removeTerrain() → {bemap.Map}
Disable 3D terrain. MapLibre only.
- Inherited From:
- Source:
Returns:
this
- Type
- bemap.Map
rotation(deg) → {bemap.LeafletMap}
Visually rotate the Leaflet map by applying a CSS `transform: rotate` to
the layer panes (NOT the whole container — that would rotate +/- controls
and the attribution widget too). Leaflet has no native rotation, so this
is a presentation-only effect:
• Tiles, polylines, markers, popups all rotate together — looks right.
• Click events still hit unrotated pixel positions, so click-to-coord
becomes inaccurate at non-zero angles.
• Tile prefetch still uses the unrotated bounds — corner tiles may be
missing when angle is between rotations.
For full-fidelity rotation with mouse/touch transforms and tile re-buffering,
use bemap.MapLibreMap (setBearing) or bemap.OlMap (rotation), or replace
leaflet.js with the Raruto/leaflet-rotate fork.
Parameters:
| Name | Type | Description |
|---|---|---|
deg |
Number |
- Overrides:
- Source:
Returns:
this
- Type
- bemap.LeafletMap
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
(protected) setCoordinateCircle(circle) → {bemap.LeafletMap}
Set the coordinates of the circle.
Parameters:
| Name | Type | Description |
|---|---|---|
circle |
bemap.Circle | the circle object to remove. |
Returns:
this
- Type
- bemap.LeafletMap
(protected) setCoordinateMarker(marker) → {bemap.LeafletMap}
Set the coordinates of the marker.
Parameters:
| Name | Type | Description |
|---|---|---|
marker |
bemap.Marker | the marker object to remove. |
Returns:
this
- Type
- bemap.LeafletMap
setCoordinatePopup(popup, coordinate, options) → {bemap.OlMap}
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
|
- Overrides:
- Source:
Returns:
this.
- Type
- bemap.OlMap
setDragPan(active) → {bemap.LeafletMap}
Enable or disable drag pan. Caches the user's intent so
`draggableMarker`'s internal mouseup-time `dragging.enable()` (in
`bemap-map-leaflet-marker.js`) can restore it without overriding
the customer's `setDragPan(false)` call.
Parameters:
| Name | Type | Description |
|---|---|---|
active |
boolean |
- Overrides:
- Source:
Returns:
this
- Type
- bemap.LeafletMap
setKeyboard(enabled) → {bemap.LeafletMap}
Toggle keyboard navigation (arrow-pan + `+`/`-` zoom) at runtime.
Parameters:
| Name | Type | Description |
|---|---|---|
enabled |
Boolean |
Returns:
- Type
- bemap.LeafletMap
setLight(options) → {bemap.Map}
Set 3D light position and properties. MapLibre only.
Parameters:
| Name | Type | Description |
|---|---|---|
options |
object | Light options (position, color, intensity, anchor). |
- Inherited From:
- 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. |
- Inherited From:
- Source:
Returns:
this
- Type
- bemap.Map
(protected) setRadiusCircle(circle) → {bemap.LeafletMap}
Set the radius of the circle.
Parameters:
| Name | Type | Description |
|---|---|---|
circle |
bemap.Circle | the circle object to remove. |
Returns:
this
- Type
- bemap.LeafletMap
setSky(options) → {bemap.Map}
Set sky/atmosphere effects. MapLibre only.
Parameters:
| Name | Type | Description |
|---|---|---|
options |
object | sky options. |
- Inherited From:
- Source:
Returns:
this
- Type
- bemap.Map
setStyle(urlOrSpec) → {bemap.LeafletMap}
Cross-engine `setStyle` for Leaflet. The MapLibre wrapper has the same name
but a richer contract (vector style name / URL / object); on Leaflet/OL
"style" means the WMS theme or the raster tile source. The argument is
interpreted as:
• bare NAME (no '/' or ':') → re-applied as the WMS `STYLES` on the BeNomad
layer(s) — the dark/light theme switch (`'benomadGrayLevel'` /
`'benomadLight'`). Vector style names are MapLibre-only, so the app passes
the right name per engine.
• URL string (contains '/' or ':') → swaps the raster tile-source URL.
• inline style object → MapLibre-only; warn-once no-op here.
Parameters:
| Name | Type | Description |
|---|---|---|
urlOrSpec |
String | Object | WMS style name (`'benomadGrayLevel'`), a raster URL template (`https://.../{z}/{x}/{y}.png`), or a MapLibre vector style object (no-op). |
- Since:
- 2.0.0
- Overrides:
- Source:
Returns:
this
- Type
- bemap.LeafletMap
setTerrain(options) → {bemap.Map}
Enable 3D terrain rendering. MapLibre only.
Parameters:
| Name | Type | Description |
|---|---|---|
options |
object | terrain options (source, exaggeration). |
- Inherited From:
- Source:
Returns:
this
- Type
- bemap.Map
setVisiblePopup(popup, visible) → {bemap.LeafletMap}
Show or hide a popup.
Added in the BEMAP-1898 audit. LeafletMap had no implementation, so
`popup.show()` / `popup.hide()` / `popup.setVisible()` (bemap-popup.js) fell
through to the base-class no-op (bemap-map.js) and did nothing at all: on
Leaflet there was NO way to close a popup, and `isVisible()` kept reporting
whatever the constructor was given. OL and MapLibre both implement it.
Parameters:
| Name | Type | Description |
|---|---|---|
popup |
bemap.Popup | |
visible |
boolean |
- Overrides:
- Source:
Returns:
this
- Type
- bemap.LeafletMap
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
switchBackgroundLayer(geoserver) → {bemap.Map}
Switch bytween several background layers.
Parameters:
| Name | Type | Description |
|---|---|---|
geoserver |
String | Name of geoserver. |
- Inherited From:
- Source:
Returns:
this
- Type
- bemap.Map
(protected) updateCircleCenter(circle) → {bemap.LeafletMap}
Sync the bemap.Circle's coordinate from its native L.circle centre. Called by
bemap.Circle.getCenter() (e.g. inside a drag callback) to read back the live
position. LeafletMap previously lacked this method, so getCenter() threw
"this.map.updateCircleCenter is not a function" on a Leaflet map after a
circle drag (PMT-37). Mirrors the OpenLayers / MapLibre contract.
Parameters:
| Name | Type | Description |
|---|---|---|
circle |
bemap.Circle |
Returns:
this
- Type
- bemap.LeafletMap
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. |
- Inherited From:
- Source:
Returns:
this
- Type
- bemap.Map
updatePolygonCoordinates(polygon) → {bemap.LeafletMap}
Sync a polygon's MODEL coordinates FROM its native geometry.
Direction matters, and this engine had it backwards (BEMAP-1898 audit).
`bemap.Polygon.getCoordinates()` calls this and *then* returns `this.coords`,
so the contract is a READ: native → model. That is what the OL engine does.
Leaflet instead did `native.setLatLngs(polygon.getLatLonArrays())` — model →
native — with two consequences:
• any native-side change (a vertex edit, a drag) was silently OVERWRITTEN by
the stale model on the next getCoordinates() call, and never reported;
• inside draggablePolygon's mousemove the native was reset to the previous
position, so the shape rendered one mousemove behind the cursor and landed
one delta short. The handler compensated with a manual delta loop, which
is removed now that this reads the right way round.
Parameters:
| Name | Type | Description |
|---|---|---|
polygon |
bemap.Polygon |
Returns:
this
- Type
- bemap.LeafletMap
visibleLayer(layer) → {bemap.LeafletMap}
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.LeafletMap
zIndexLayer(layer, zIndex) → {bemap.LeafletMap}
Re-stack a layer relative to the others. Leaflet has no native z-index on
`L.layerGroup`, so we mutate the sub-layers individually:
• Markers (`L.Marker`) → setZIndexOffset(±1000) so high vs low layers
visually separate even when the DOM order is unchanged.
• Paths (polyline / polygon / circle, `L.Path` subclasses) →
bringToFront() / bringToBack().
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.LeafletMap
zoom(zoom, options) → {bemap.LeafletMap}
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.LeafletMap