Map Controls
Set View State
Using the setViewState(...)
API function user can position the map view on a certain location based on provided coordinates at a defined zoom level. Optionally limits the user's zoom and bounds the viewport to an area specified by a set of coordinates.
UnfoldedMap.setViewState(viewState: ViewState): void
interface ViewState {
longitude?: number;
latitude?: number;
zoom?: number;
minZoom?: number;
maxZoom?: number;
maxBounds?: Bounds;
}
Parameters
Name Description longitude number
(Optional)
Longitude of map centerlatitude number
(Optional)
Latitude of map centerzoom number
(Optional)
Current zoom of the mapminZoom number
(Optional)
Minimum allowed zoom levelmaxZoom number
(Optional)
Maximum allowed zoom levelmaxBounds array[number]
(Optional)
Maximum bounds
Set Split Mode
Using the setSplitMode(...)
API function user can change the map Split Mode between dual, swipe, or single mode. Allows the user to pass layer id's to set layer visibility per split view.
UnfoldedMap.setSplitMode(mode: MapSplitMode, layers?: string[][]): void
enum MapSplitMode {
SINGLE = 'single',
DUAL = 'dual',
SWIPE = 'swipe'
}
Name Description mode DUALChoice between SINGLE / DUAL / SWIPE
modelayers string[][]
(Optional)
Array of layer id's to set layer visibility per split view.- First element in the array contains the id's of the layers that should be visible in the left half of the map.
- Second element in the array contains the id's of the layers that should be visible in the right half of the map.
- If the id of an existing and visible layer is not listed in one or both of the elements, layer will be hidden from that half of the map.
Set Map Controls Visibility
Using the setMapControlVisibility(...)
API function user can control the visibility of map controls such as the map legend, 2D/3D view control, split map control, and map draw control.
Name Description panelId mapLegendString id that identifies the map control. Can be: 'mapLegend' / 'toggle3d' / 'splitMap' / 'mapDraw'
mapControlConfig.isVisible boolean
Set the visibility of the map control to true or false.