chooseLocation(params: Object)

Requires:
MapKit≥1.0.6@ray-js/ray≥1.2.10
Platforms:
iOSAndroid
import { map } from '@ray-js/ray';

const { chooseLocation } = map;

// Promise usage
try {
  const res = await chooseLocation({ ...params });
  console.log(res);
} catch (err) {
  console.log(err.errorMsg);
}

Description

Open the map to select a location

Parameters

PropertyTypeRequiredDescriptionMapKit Since
latitudenumberNoTarget latitude-
longitudenumberNoTarget longitude-
titlestringNoTitlev7.4.0
detailTextstringNoDetailed description textv7.4.0
complete() => voidNoCompletion callback (executed on both success and failure)-
success(params: Object) => voidNoCallback on successful API call-
fail(params: Object) => voidNoFailure callback-
success callback parameters
PropertyTypeDescriptionMapKit Since
namestringLocation namev3.0.5
addressstringDetailed addressv3.0.5
latitudenumberLatitude, floating-point number, range -90~90; negative values indicate south latitude. Uses the gcj02 coordinate system.v3.0.5
longitudenumberLongitude, floating-point number, range -180~180; negative values indicate west longitude. Uses the gcj02 coordinate system.v3.0.5
fail callback parameters
PropertyTypeDescription
errorMsgstringError message
errorCodestring | numberError code
Error extension

Return Value

None

Examples

import { map } from '@ray-js/ray'

map.chooseLocation({
  latitude: 39.908823,
  longitude: 116.39747,
  title: "xx",
  detailText: "xx",
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});