Skip to main content
Version: 1.0.0

Map View

Set View

Using the setView(...) 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.

/**
* Sets the view state of the map.
* @param view The new view state of the map.
* @returns The new view state of the map.
*/
setView(view: Partial<View>): View;
type View = {
/** Longitude of the view center [-180, 180]. */
longitude: number;
/** Latitude of the view center [-90, 90]. */
latitude: number;
/** View zoom level [0-22]. */
zoom: number;
/** View pitch value [0-90]. */
pitch: number;
/** View bearing. */
bearing: number;
};

Parameters

  • NameDescription
    longitude number
    (Optional) Longitude of map center
    latitude number
    (Optional) Latitude of map center
    zoom number
    (Optional) Current zoom of the map
    pitch number
    (Optional) Current pitch of the map
    bearing number
    (Optional) Current bearing of the map

Get View

/**
* Gets the current view state of the map.
* @returns The current view state of the map.
*/
getView(): View;

Parameters

Set View limits

Using the setViewLimits(...) API function user can set minimum and/or maximum values of zoom value, and maximum allowed map bounds.

/**
* Sets the view limits of the map.
* @param viewLimits The new view limits of the map.
* @returns The new view limits of the map.
*/
setViewLimits(viewLimits: Partial<ViewLimits>): ViewLimits;
type ViewLimits = {
/** Minimum allowed zoom level. */
minZoom: number;
/** Maximum allowed zoom level. */
maxZoom: number;
/** Maximum allowed bounds. */
maxBounds?: Bounds;
};
/**
* Type representing map bounds.
*/
type Bounds = {
/** Minimum (left) longitude value. */
minLongitude: number;
/** Maximum (right) longitude value. */
maxLongitude: number;
/** Minimum (bottom) latitude value. */
minLatitude: number;
/** Maximum (top) latitude value. */
maxLatitude: number;
};

Parameters

  • NameDescription
    minZoom number
    (Optional) Minimum allowed zoom level
    maxZoom number
    (Optional) Maximum allowed zoom level
    minLongitude number
    (Optional) Minimum Longitude
    maxLongitude number
    (Optional) Maximum Longitude
    minLatitude number
    (Optional) Minimum Latitude
    maxLatitude number
    (Optional) Maximum Latitude

Get View Limits

/**
* Gets the current view limits of the map.
* @returns The current view limits of the map.
* @link https://docs.unfolded.ai/placeholder
*/
getViewLimits(): ViewLimits;

Parameters