Constructor
new Map(target, options)
Parameters:
Name | Type | Description |
---|---|---|
target |
string/HTMLElement | id or HTMLElement |
options |
Object | options object |
- Source:
Methods
addLayer(layer)
Generic Add Layer method. Only adds a layer if the map crs code matches
Parameters:
Name | Type | Description |
---|---|---|
layer |
Layer |
- Source:
addTool(tool, position)
Add a tool to the tool overlay
Parameters:
Name | Type | Description |
---|---|---|
tool |
UiElement | HTMLElement | |
position |
string | top-left, top-right, bottom-left, bottom-right |
- Source:
closePopup()
Close the currently opened popup
- Source:
fitBounds(bbox)
Parameters:
Name | Type | Description |
---|---|---|
bbox |
object | { min: {x, y}, max: {x, y}, crs: "CRS:84" } |
- Source:
fitToScreen()
Fill the entire screen (map height) with the full map extend
- Source:
getBaseLayer() → {Layer}
Get the current baselayer
- Source:
Returns:
baseLayer
- Type
- Layer
getBounds() → {object}
Get the current bounds of the map
- Source:
Returns:
{ min: {x, y}, max: {x, y}, crs: "CRS:84" }
- Type
- object
getFeatureInfoOptions(lat, lng, width, height)
Build a bounding box from a click location
for getFeatureInfo requests
Parameters:
Name | Type | Description |
---|---|---|
lat |
number | click lat |
lng |
number | click lng |
width |
number | in pixels |
height |
number | in pixels |
- Source:
getLayers() → {Array.<Layer>}
Get layers added to the map
- Source:
Returns:
list of layers
- Type
- Array.<Layer>
getMaxZoom() → {number}
Wrapper method to get the max zoom of the map
- Source:
Returns:
max zoom level
- Type
- number
getMinZoom() → {number}
Wrapper method to get the min zoom of the map
- Source:
Returns:
min zoom level
- Type
- number
getOptions() → {object}
Get the current map options
- Source:
Returns:
options
- Type
- object
getZoom() → {number}
Wrapper method to get the current zoom of the map
- Source:
Returns:
zoom level
- Type
- number
initContainers_()
initialize div containers
- Source:
removeLayer(layer)
Generic Remove Layer method
Parameters:
Name | Type | Description |
---|---|---|
layer |
Layer |
- Source:
setActiveArea(className, centerMap)
sets the active area div
Parameters:
Name | Type | Description |
---|---|---|
className |
string | css class name |
centerMap |
boolean | automatically re-center the map (default = false) |
- Source:
setBaseLayer(layer, crs)
Set baselayer and projection. Crs and layer need to match.
Either option can be ommited, if the current baselayer/crs
matches the changed property
Parameters:
Name | Type | Description |
---|---|---|
layer |
Layer | |
crs |
string |
- Source:
setMaxBounds(bbox)
Parameters:
Name | Type | Description |
---|---|---|
bbox |
object | { min: {x, y}, max: {x, y}, crs: "CRS:84" } |
- Source:
setView(latLng, zoom)
Parameters:
Name | Type | Description |
---|---|---|
latLng |
Array.<number> | |
zoom |
number |
- Source:
showPopup(lat, lng, content)
Wrapper method for showing a popup on the map
Parameters:
Name | Type | Description |
---|---|---|
lat |
number | |
lng |
number | |
content |
string |
- Source:
startDrawing(shape)
Start drawing shapes on the map
Parameters:
Name | Type | Description |
---|---|---|
shape |
string | rectangle, polygon, line, point |
- Source:
stopDrawing()
Abort drawing
- Source:
zoomIn()
Wrapper method to zoom in one step
- Source:
zoomOut()
Wrapper method to zoom out one step
- Source: