MapContext.updateComponents
Update the map API incrementally.
Parameters
Property | Type | Description |
latitude | Number | The latitude of the center location. |
longitude | Number | The longitude of the center location. |
scale | Number | Zoom level. The value ranges from 5 to 18. The default value is 16. |
markers | Array | Point markers that overlay the map. |
polyline | Array | A set of consecutive points (a route) that overlays the map. |
include-points | Array | Slightly zoom out the map to include these points. |
include-padding | Object | Show the map inside the area that includes paddings. |
settings | Object | The settings. |
Sample code
copy
this.mapCtx = my.createMapContext('map');
this.mapCtx.updateComponents({
scale: 14,
longitude: 103.863718,
latitude: 1.351628,
setting:{
// Gesture
gestureEnable:0/1,
// Scale
showScale:0/1,
// Compass
showCompass:0/1,
// Tilt gestures with both hands
tiltGesturesEnabled:0/1,
// Show or hide traffic
trafficEnabled:0/1,
// Points of interest on the map
showMapText:0/1,
// Location of Amap logo
logoPosition:{centerX:150, centerY:90},
},
markers:[{},{}],
polyline:[{},{}],
include-points:[{},{}],
include-padding:{left:0, right:0, top:0, bottom:0},
});