---
name: "chooseLocation"
mode: "kit"
versionRequirements:
  - { name: "MapKit", version: "1.0.6" }
  - { name: "@ray-js/ray", version: "1.2.10" }
platform:
  - "iOS"
  - "Android"
async: true
title: "map.chooseLocation"
---

## chooseLocation

> [VERSION] MapKit >= 1.0.6 | @ray-js/ray >= 1.2.10

> [PLATFORM] iOS, Android

> ⚡ **Supports Promise** — Returns a Promise when success / fail / complete callbacks are omitted.

### Description

Open the map to select a location

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `latitude` | `number` | No | - | `1.0.6` | Target latitude |
| `longitude` | `number` | No | - | `1.0.6` | Target longitude |
| `title` | `string` | No | - | `7.4.0` | Title |
| `detailText` | `string` | No | - | `7.4.0` | Detailed description text |
| `complete` | `() => void` | No | - | - | Completion callback (executed on both success and failure) |
| `success` | `(params: Object) => void` ↓see below | No | - | - | Callback on successful API call |
| `fail` | `(params: Object) => void` ↓see below | No | - | - | Failure callback |

#### success callback parameters

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `name` | `string` | `3.0.5` | Location name |
| `address` | `string` | `3.0.5` | Detailed address |
| `latitude` | `number` | `3.0.5` | Latitude, floating-point number, range -90~90; negative values indicate south latitude. Uses the gcj02 coordinate system. |
| `longitude` | `number` | `3.0.5` | Longitude, floating-point number, range -180~180; negative values indicate west longitude. Uses the gcj02 coordinate system. |

#### fail callback parameters

| Property | Type | Description |
| --- | --- | --- |
| `errorMsg` | `string` | Error message |
| `errorCode` | `string \| number` | Error code |
| `innerError` | `Object` | Error extension |

##### fail(params).innerError properties

| Property | Type | Description |
| --- | --- | --- |
| `errorCode` | `string \| number` | Error extension code |
| `errorMsg` | `string` | Error extension message |


### Examples

#### Basic call

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

const { chooseLocation } = map;

chooseLocation({
  success: (result) => {
    console.log('chooseLocation success', result);
  },
  fail: (error) => {
    console.log('chooseLocation fail', error.errorMsg);
  },
});
```
