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
Name Description longitude number
(Optional)
Longitude of map centerlatitude number
(Optional)
Latitude of map centerzoom number
(Optional)
Current zoom of the mappitch number
(Optional)
Current pitch of the mapbearing 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
Name Description minZoom number
(Optional)
Minimum allowed zoom levelmaxZoom number
(Optional)
Maximum allowed zoom levelminLongitude number
(Optional)
Minimum LongitudemaxLongitude number
(Optional)
Maximum LongitudeminLatitude number
(Optional)
Minimum LatitudemaxLatitude 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;