Skip to main content
Version: 0.7.3

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

  • NameDescription
    longitude number
    (Optional) Longitude of map center
    latitude number
    (Optional) Latitude of map center
    zoom number
    (Optional) Current zoom of the map
    minZoom number
    (Optional) Minimum allowed zoom level
    maxZoom number
    (Optional) Maximum allowed zoom level
    maxBounds 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'
}
  • NameDescription
    mode
    Choice between SINGLE / DUAL / SWIPE mode
    layers 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.

  • NameDescription
    panelId
    String 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.