Map
# createMapContext
createMapContext(string mapId)
Create a map context MapContext object.
Parameters
The parameter string mapId is the id of the map component
Return Value
MapContext
# MapContext
# MapContext.addCustomLayer
Not supported
# MapContext.addGroundOverlay
Not supported
# MapContext.addMarkers
Add a marker.
Support:
System Maps (iOS support only)
✅Map of Gaode
iOS:✅ Android:✅ IDE:✅Baidu Maps (iOS, Android support only)
iOS:✅ Android:✅Google Maps (Android only)
✅
# parameters
| Properties | Type | The default value is | Required | Note | Other |
|---|---|---|---|---|---|
| markers | Array | Yes | The same as the marker property | passed into the map component | |
| clear | boolean | false | No | Whether to empty all marker | on the map first iOS does not support |
| success | function | No | The interface calls the callback function successfully | ||
| fail | function | No | The callback function that failed the interface callback function | ||
| complete | function | No | The callback function at the end of the interface call (the call succeeds or fails) |
# MapContext.addVisualLayer
Not supported
# MapContext.fromScreenLocation
Return to latitude and longitude in the upper-left corner of the map.
Support:
System Maps (iOS support only)
✅Map of Gaode
iOS:✅ Android:✅ IDE:✅Baidu Maps (iOS, Android support only)
iOS:✅ Android:✅Google Maps (Android only)
✅
# parameters
| Properties | Type | The default value is | Required | Note | Other |
|---|---|---|---|---|---|
| success | function | No | The interface calls the callback function successfully | ||
| fail | function | No | The callback function that failed the interface callback function | ||
| complete | function | No | The callback function at the end of the interface call (the call succeeds or fails) |
# MapContext.getCenterLocation
Gets the latitude and longitude of the current map center.
Support:
System Maps (iOS support only)
✅Map of Gaode
iOS:✅ Android:✅ IDE:✅Baidu Maps (iOS, Android support only)
iOS:✅ Android:✅Google Maps (Android only)
✅
# parameters
| Properties | Type | The default value is | Required | Note | Other |
|---|---|---|---|---|---|
| iconPath | string | No | Icon path, support network path, local path, code package path, | iOS does not support | |
| success | function | No | The interface calls the callback function successfully | ||
| fail | function | No | The callback function that failed the interface callback function | ||
| complete | function | No | The callback function at the end of the interface call (the call succeeds or fails) |
# MapContext.getRegion
Gets the field of view extent of the current map.
Support:
System Maps (iOS support only)
✅Map of Gaode
iOS:✅ Android:✅ IDE:✅Baidu Maps (iOS, Android support only)
iOS:✅ Android:✅Google Maps (Android only)
✅
# parameters
| Properties | Type | The default value is | Required | Note | Other |
|---|---|---|---|---|---|
| success | function | No | The interface calls the callback function successfully | ||
| fail | function | No | The callback function that failed the interface callback function | ||
| complete | function | No | The callback function at the end of the interface call (the call succeeds or fails) |
# MapContext.getRotate
Gets the rotation angle of the current map.
Support:
System Maps (iOS support only)
❌Map of Gaode
iOS:✅ Android:✅ IDE:✅Baidu Maps (iOS, Android support only)
iOS:✅ Android:✅Google Maps (Android only)
✅
# parameters
| Properties | Type | The default value is | Required | Note | Other |
|---|---|---|---|---|---|
| success | function | No | The interface calls the callback function successfully | ||
| fail | function | No | The callback function that failed the interface callback function | ||
| complete | function | No | The callback function at the end of the interface call (the call succeeds or fails) |
# MapContext.getScale
Gets the zoom level of the current map.
Support:
System Maps (iOS support only)
✅Map of Gaode
iOS:✅ Android:✅ IDE:✅Baidu Maps (iOS, Android support only)
iOS:✅ Android:✅Google Maps (Android only)
✅
# parameters
| Properties | Type | The default value is | Required | Note | Other |
|---|---|---|---|---|---|
| success | function | No | The interface calls the callback function successfully | ||
| fail | function | No | The callback function that failed the interface callback function | ||
| complete | function | No | The callback function at the end of the interface call (the call succeeds or fails) |
# MapContext.getSkew
Gets the tilt angle of the current map.
Support:
System Maps (iOS support only)
❌Map of Gaode
iOS:✅ Android:✅ IDE:✅Baidu Maps (iOS, Android support only)
iOS:✅ Android:✅Google Maps (Android only)
✅
# parameters
| Properties | Type | The default value is | Required | Note | Other |
|---|---|---|---|---|---|
| success | function | No | The interface calls the callback function successfully | ||
| fail | function | No | The callback function that failed the interface callback function | ||
| complete | function | No | The callback function at the end of the interface call (the call succeeds or fails) |
# MapContext.includePoints
Zoomed view shows all latitude and longitude.
Support:
System Maps (iOS support only)
✅Map of Gaode
iOS:✅ Android:✅ IDE:❌Baidu Maps (iOS, Android support only)
iOS:✅ Android:✅Google Maps (Android only)
✅
# parameters
| Properties | Type | The default value is | Required | Note | Other |
|---|---|---|---|---|---|
| points | Array.Object> | Yes | The list of coordinate points to display in the viewable area | ||
| padding | Array.number> | No | The distance from the edge of the rectangle formed by the coordinate points to the edge of the map, in pixels. The format is [top, right, bottom, left]. | Android Google Maps can only recognize the first item of the array, up and down left and right padding consistent | |
| The IDE does not support | |||||
| success | function | No | The interface calls the callback function successfully | ||
| fail | function | No | The callback function that failed the interface callback function | ||
| complete | function | No | The callback function at the end of the interface call (the call succeeds or fails) |
# MapContext.initMarkerCluster
Initializes the configuration of the point aggregation, which is the default configuration when not called.
Support:
System Maps (iOS support only)
❌Map of Gaode
iOS: ❌ Android: ✅ does not support enableDefaultStyle IDE: ❌Baidu Maps (iOS, Android support only)
iOS: ❌ Android: ✅ enableDefaultStyle is not supportedGoogle Maps (Android only)
✅ > do not support enableDefaultStyle
# parameters
| Properties | Type | The default value is | Required | Note | Other |
|---|---|---|---|---|---|
| enableDefaultStyle | boolean | true | No | Enable the default aggregation style | |
| zoomOnClick | boolean | true | No | Whether to implement aggregation separation when clicking a marker point that has already been aggregated | |
| gridSize | number | 60 | No | The aggregateable distance of the aggregation algorithm, that is, points that are less than that value are aggregated together in pixels | |
| success | function | No | The interface calls the callback function successfully | ||
| fail | function | No | The callback function that failed the interface callback function | ||
| complete | function | No | The callback function at the end of the interface call (the call succeeds or fails) |
# MapContext.moveAlong
moves the marker along a specified path for scenes such as track playback. A callback event is triggered when the animation is complete, and if the animation is in progress and the moveAlong method is called again for the same marker, the previous animation will be interrupted.
Support:
System Maps (iOS support only)
✅Map of Gaode
iOS:✅ Android:✅ IDE:✅Baidu Maps (iOS, Android support only)
iOS:✅ Android:✅Google Maps (Android only)
✅
# parameters
| Properties | Type | The default value is | Required | Note | Other |
|---|---|---|---|---|---|
| markerId | number | Yes | Specifies the marker | ||
| path | Array | Yes | The coordinate string of the moving path, the coordinate point format {longitude, latitude} | ||
| autoRotate | boolean | true | No | Automatically changes the rotation angle of the marker | based on the path direction iOS does not support |
| The IDE does not support it, and does not change the marker rotation angle | by default | ||||
| duration | number | Yes | Smooth movement time | ||
| success | function | No | The interface calls the callback function successfully | ||
| fail | function | No | The callback function that failed the interface callback function | ||
| complete | function | No | The callback function at the end of the interface call (the call succeeds or fails) |
# MapContext.moveToLocation
Shift the center of the map to the current anchor point.
Support:
System Maps (iOS support only)
✅Map of Gaode
iOS:✅ Android:✅ IDE:✅Baidu Maps (iOS, Android support only)
iOS:✅ Android:✅Google Maps (Android only)
✅
# parameters
| Properties | Type | The default value is | Required | Note | Other |
|---|---|---|---|---|---|
| longitude | number | No | Longitude | ||
| latitude | number | No | Latitude | ||
| success | function | No | The interface calls the callback function successfully | ||
| fail | function | No | The callback function that failed the interface callback function | ||
| complete | function | No | The callback function at the end of the interface call (the call succeeds or fails) |
# MapContext.on
Listen for map events: 'markerClusterCreate' scale or drag triggers when a new aggregation cluster is generated, returning only the newly created aggregation cluster information; 'markerClusterClick' aggregation cluster click event.
Support:
System Maps (iOS support only)
❌Map of Gaode
iOS: ❌ Android: ✅ does not support markerClusterCreate IDE: ❌Baidu Maps (iOS, Android support only)
iOS: ❌ Android: ✅ MarkerClusterCreate is not supportedGoogle Maps (Android only)
✅ > markerClusterCreate is not supported
# Sample code
# MapContext.openMapApp
Pull up the Maps app and select Navigation.
Support:
System Maps (iOS support only)
✅Map of Gaode
iOS:✅ Android:✅ IDE:❌Baidu Maps (iOS, Android support only)
iOS:✅ Android:✅Google Maps (Android only)
✅
# parameters
| Properties | Type | The default value is | Required | Note | Other |
|---|---|---|---|---|---|
| longitude | Number | Yes | Destination longitude | ||
| latitude | Number | Yes | Destination latitude | ||
| destination | String | Yes | Destination Name | ||
| success | function | No | The interface calls the callback function successfully | ||
| fail | function | No | The callback function that failed the interface callback function | ||
| complete | function | No | The callback function at the end of the interface call (the call succeeds or fails) |
# MapContext.removeCustomLayer
Not supported
# MapContext.removeGroundOverlay
Not supported
# MapContext.removeMarkers
Remove marker.
Support:
System Maps (iOS support only)
✅Map of Gaode
iOS:✅ Android:✅ IDE:✅Baidu Maps (iOS, Android support only)
iOS:✅ Android:✅Google Maps (Android only)
✅
# parameters
| Properties | Type | The default value is | Required | Note | Other |
|---|---|---|---|---|---|
| markerIds | Array | Yes | The id collection of markers. | ||
| success | function | No | The interface calls the callback function successfully | ||
| fail | function | No | The callback function that failed the interface callback function | ||
| complete | function | No | The callback function at the end of the interface call (the call succeeds or fails) |
# MapContext.removeVisualLayer
Not supported.
# MapContext.setCenterOffset
set the map center point offset, which grows backwards and downwards, with a screen scale range (0.25 to 0.75) and a default offset of [0.5, 0.5].
Support:
System Maps (iOS support only)
❌Map of Gaode
iOS:✅ Android:✅ IDE:❌Baidu Maps (iOS, Android support only)
iOS:❌ Android:❌Google Maps (Android only)
❌
# parameters
| Properties | Type | The default value is | Required | Note | Other |
|---|---|---|---|---|---|
| offset | Array.number> | Yes | Offset, two-digit array | ||
| success | function | No | The interface calls the callback function successfully | ||
| fail | function | No | The callback function that failed the interface callback function | ||
| complete | function | No | The callback function at the end of the interface call (the call succeeds or fails) |
# MapContext.setLocMarkerIcon
Set anchor icons to support network paths, local paths, and code package paths.
Support:
System Maps (iOS support only)
❌Map of Gaode
iOS:✅ Android:✅ IDE:❌Baidu Maps (iOS, Android support only)
iOS:✅ Android:✅Google Maps (Android only)
❌
# parameters
| Properties | Type | The default value is | Required | Note | Other |
|---|---|---|---|---|---|
| iconPath | string | No | Icon path, support network path, local path, code package path, | ||
| success | function | No | The interface calls the callback function successfully | ||
| fail | function | No | The callback function that failed the interface callback function | ||
| complete | function | No | The callback function at the end of the interface call (the call succeeds or fails) |
# MapContext.toScreenLocation
Get the screen coordinates corresponding to the latitude and longitude, and the coordinate origin is the upper left corner of the map.
Support:
System Maps (iOS support only)
✅Map of Gaode
iOS:✅ Android:✅ IDE:❌Baidu Maps (iOS, Android support only)
iOS:✅ Android:✅Google Maps (Android only)
✅
# parameters
| Properties | Type | The default value is | Required | Note | Other |
|---|---|---|---|---|---|
| success | function | No | The interface calls the callback function successfully | ||
| fail | function | No | The callback function that failed the interface callback function | ||
| complete | function | No | The callback function at the end of the interface call (the call succeeds or fails) |
# MapContext.translateMarker
Pan marker with animation.
Support:
System Maps (iOS support only)
✅Map of Gaode
iOS:✅ Android:✅ IDE:✅Baidu Maps (iOS, Android support only)
iOS:✅ Android:✅Google Maps (Android only)
✅
# parameters
| Properties | Type | The default value is | Required | Note | Other |
|---|---|---|---|---|---|
| markerId | Number | Yes | Specifies the marker | ||
| destination | Object | Yes | Specifies the target point to which the marker moves | ||
| autoRotate | boolean | Yes | Whether the marker | is automatically rotated during the move iOS does not support | |
| The IDE does not support it, and does not change the marker rotation angle | by default | ||||
| rotate | Number | Yes | The rotation angle of the marker is | iOS does not support | |
| moveWithRotate | boolean | false | No | Translation and rotation are | simultaneously iOS does not support |
| The IDE does not support | |||||
| duration | Number | 1000 | No | The animation lasts for a long time, and the translation and rotation are calculated separately | |
| animationEnd | function | No | The end of animation callback function | ||
| success | function | No | The interface calls the callback function successfully | ||
| fail | function | No | The callback function that failed the interface callback function | ||
| complete | function | No | The callback function at the end of the interface call (the call succeeds or fails) |
# MapContext.updateGroundOverlay
Not supported