MapContext.getRegion

Get the coordinates of the northeast and southwest corners of the current map.

Parameters

Property

Type

Required

Description

success

Function

No

The callback function that is called upon successful call.

fail

Function

No

The callback function that is called upon failed call.

complete

Function

No

The callback function that is called upon call completion (to be executed upon either call success or failure).

Success callback function

The parameters are in object type and have the following properties:

Property

Type

Description

northeast

Object

The coordinates (including longitude and latitude) of the northeas corner of the map.

Example:

copy
{
"longitude":116.393761485815,
"latitude":39.9015997437344
}

southwest

Object

The coordinates (including longitude and latitude) of the southwest corner of the map.

Example:

copy
{
"longitude":116.386248618364,
"latitude":39.89839488008665
}

Sample code

copy
this.mapCtx = my.createMapContext('map');
this.mapCtx.getRegion({
    success: res => {
        console.log(res);
    },
    fail: error => {
        console.log(error)
    },
    complete: res => {
        console.log(res)
    }
});