Location:

Map Status

The map status includes the map center point, zoom level, and more. This chapter introduces you to common ways to set/get map status, including:
1. Set / get the map center point and zoom level;
2. Adjust the field of view according to the coverage range;
3. A list of commonly used methods.

Settings / Get Map Center Points and Levels

Setting and getting the map center point (setCenter, getCenter):

                    // Pass in latitude and longitude to set the map center point
                    var position = [116.2123, 39.213123];
                    map.setCenter(position);
                    // Get the map center point
                    var currentCenter = map.getCenter();
                

Settings, getting the map zoom level (setZoom, getZoom):

                    map.setZoom(12);
                    // Get the map level
                    var currentCenter = map.getZoom();
                

List of common methods

The following table lists common settings / how to get map status

MethodDescription

getZoom( )

Get the current map zoom level

setZoom(level:Number)

Set the zoom level for map display

getCenter( )

Get the latitude and longitude coordinate values ​​of the map center point.

setCenter(position: LngLat)

Set the center point of the map display.

jumpTo(positon:LngLat)

The map center point is translated to the specified point position.

TOP