MapContext.includePoints
Adjust (move and zoom) the visible area of the map to display the specified coordinates in the map view area.
Parameters
Property | Type | Required | Description |
points | Array<Object> | Yes | The list of coordinate points to be displayed within the visible area of the map. Example: copy
|
padding | Array<Number> | No | The distance from the edges of the polygon (that is formed by the coordinate points) to the edges of the map.
|
success | Function | No | The callback function that is called upon successful call. |
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). |
fail
callback function
The parameter of the fail callback function is an object, where:
error
: indicates the error codeerrorMessage
: indicates the error message.
Error code
Error code | Error message | Further action |
2 | Invalid parameters. For example, the data type is incorrect.
| Fill in the correct parameters per the Parameters section. |
Sample code
this.mapCtx = my.createMapContext('map');
this.mapCtx.includePoints({
points: [
{
latitude: 39.935029,
longitude: 116.384377,
},
{
latitude: 39.939577,
longitude: 116.388331,
},
],
padding: [48, 48, 48, 48],
success: (res) => {
console.log("success", res);
},
fail: (error) => {
console.log("fail", error);
},
});