Skip to main content
Get the user’s current location coordinates.

Parameters

PropertyTypeRequiredDescription
typeStringNoCoordinate type: gcj02 (default) or wgs84
cacheTimeoutNumberNoCache timeout in seconds
successFunctionNoCallback with location
failFunctionNoCallback on failure
completeFunctionNoCallback that always executes

Success Callback

PropertyTypeDescription
latitudeNumberLatitude
longitudeNumberLongitude
accuracyNumberAccuracy in meters
speedNumberSpeed in m/s

Code Example

my.getLocation({
  type: 'gcj02',
  success: (res) => {
    console.log('Lat:', res.latitude);
    console.log('Lng:', res.longitude);
  }
});

my.openLocation

Open location in map

my.chooseLocation

Choose a location