expo-gaode-map-web-api 1.0.1-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +632 -0
- package/build/index.d.ts +91 -0
- package/build/index.js +186 -0
- package/build/services/GeocodeService.d.ts +97 -0
- package/build/services/GeocodeService.js +133 -0
- package/build/services/InputTipsService.d.ts +103 -0
- package/build/services/InputTipsService.js +127 -0
- package/build/services/POIService.d.ts +133 -0
- package/build/services/POIService.js +174 -0
- package/build/services/RouteService.d.ts +149 -0
- package/build/services/RouteService.js +203 -0
- package/build/types/geocode.types.d.ts +326 -0
- package/build/types/geocode.types.js +5 -0
- package/build/types/inputtips.types.d.ts +69 -0
- package/build/types/inputtips.types.js +6 -0
- package/build/types/poi.types.d.ts +319 -0
- package/build/types/poi.types.js +7 -0
- package/build/types/route.types.d.ts +636 -0
- package/build/types/route.types.js +71 -0
- package/build/utils/client.d.ts +78 -0
- package/build/utils/client.js +144 -0
- package/build/utils/errorCodes.d.ts +35 -0
- package/build/utils/errorCodes.js +396 -0
- package/package.json +39 -0
- package/package.json.backup +40 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 高德地图 Web API - 输入提示服务
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.InputTipsService = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* 输入提示服务
|
|
10
|
+
* 提供根据用户输入的关键词查询返回建议列表
|
|
11
|
+
*/
|
|
12
|
+
class InputTipsService {
|
|
13
|
+
constructor(client) {
|
|
14
|
+
this.client = client;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 获取输入提示
|
|
18
|
+
* 根据用户输入的关键词返回建议列表
|
|
19
|
+
*
|
|
20
|
+
* @param keywords 查询关键词
|
|
21
|
+
* @param options 可选参数
|
|
22
|
+
* @returns 输入提示结果
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* // 基础搜索
|
|
27
|
+
* const result = await inputTips.getTips('肯德基');
|
|
28
|
+
*
|
|
29
|
+
* // 指定城市搜索
|
|
30
|
+
* const result = await inputTips.getTips('肯德基', {
|
|
31
|
+
* city: '北京',
|
|
32
|
+
* citylimit: true
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* // 指定位置和类型
|
|
36
|
+
* const result = await inputTips.getTips('银行', {
|
|
37
|
+
* location: '116.481488,39.990464',
|
|
38
|
+
* type: '150100',
|
|
39
|
+
* city: '010'
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* // 搜索公交站点
|
|
43
|
+
* const result = await inputTips.getTips('天安门', {
|
|
44
|
+
* city: '北京',
|
|
45
|
+
* datatype: 'bus'
|
|
46
|
+
* });
|
|
47
|
+
*
|
|
48
|
+
* // 搜索公交线路
|
|
49
|
+
* const result = await inputTips.getTips('1路', {
|
|
50
|
+
* city: '北京',
|
|
51
|
+
* datatype: 'busline'
|
|
52
|
+
* });
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
async getTips(keywords, options) {
|
|
56
|
+
const params = {
|
|
57
|
+
keywords,
|
|
58
|
+
...options,
|
|
59
|
+
};
|
|
60
|
+
return this.client.request('/v3/assistant/inputtips', params);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* 获取 POI 输入提示
|
|
64
|
+
* 仅返回 POI 类型的建议
|
|
65
|
+
*
|
|
66
|
+
* @param keywords 查询关键词
|
|
67
|
+
* @param options 可选参数
|
|
68
|
+
* @returns 输入提示结果
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* const result = await inputTips.getPOITips('餐厅', {
|
|
73
|
+
* city: '北京',
|
|
74
|
+
* type: '050000'
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
async getPOITips(keywords, options) {
|
|
79
|
+
return this.getTips(keywords, {
|
|
80
|
+
...options,
|
|
81
|
+
datatype: 'poi',
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* 获取公交站点输入提示
|
|
86
|
+
* 仅返回公交站点类型的建议
|
|
87
|
+
*
|
|
88
|
+
* @param keywords 查询关键词
|
|
89
|
+
* @param options 可选参数
|
|
90
|
+
* @returns 输入提示结果
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* const result = await inputTips.getBusTips('天安门', {
|
|
95
|
+
* city: '北京'
|
|
96
|
+
* });
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
async getBusTips(keywords, options) {
|
|
100
|
+
return this.getTips(keywords, {
|
|
101
|
+
...options,
|
|
102
|
+
datatype: 'bus',
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* 获取公交线路输入提示
|
|
107
|
+
* 仅返回公交线路类型的建议
|
|
108
|
+
*
|
|
109
|
+
* @param keywords 查询关键词
|
|
110
|
+
* @param options 可选参数
|
|
111
|
+
* @returns 输入提示结果
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```typescript
|
|
115
|
+
* const result = await inputTips.getBuslineTips('1路', {
|
|
116
|
+
* city: '北京'
|
|
117
|
+
* });
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
async getBuslineTips(keywords, options) {
|
|
121
|
+
return this.getTips(keywords, {
|
|
122
|
+
...options,
|
|
123
|
+
datatype: 'busline',
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.InputTipsService = InputTipsService;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 高德地图 Web API - POI 搜索服务
|
|
3
|
+
*/
|
|
4
|
+
import { GaodeWebAPIClient } from '../utils/client';
|
|
5
|
+
import type { POISearchParams, POIAroundParams, POIPolygonParams, POISearchResponse } from '../types/poi.types';
|
|
6
|
+
/**
|
|
7
|
+
* POI 搜索服务
|
|
8
|
+
*/
|
|
9
|
+
export declare class POIService {
|
|
10
|
+
private client;
|
|
11
|
+
constructor(client: GaodeWebAPIClient);
|
|
12
|
+
/**
|
|
13
|
+
* 关键字搜索
|
|
14
|
+
* 根据关键字搜索POI
|
|
15
|
+
*
|
|
16
|
+
* @param keywords 查询关键字(keywords 或 types 二选一必填)
|
|
17
|
+
* @param options 可选参数
|
|
18
|
+
* @returns POI 搜索结果
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* // 基础搜索
|
|
23
|
+
* const result = await poi.search('肯德基', { region: '北京市' });
|
|
24
|
+
*
|
|
25
|
+
* // 限制城市
|
|
26
|
+
* const result = await poi.search('肯德基', {
|
|
27
|
+
* region: '北京市',
|
|
28
|
+
* city_limit: true,
|
|
29
|
+
* page_size: 20,
|
|
30
|
+
* page_num: 1
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* // 指定类型搜索
|
|
34
|
+
* const result = await poi.search('', {
|
|
35
|
+
* types: '050000', // 餐饮服务
|
|
36
|
+
* region: '北京市',
|
|
37
|
+
* show_fields: 'children,business,photos'
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
search(keywords?: string, options?: Omit<POISearchParams, 'keywords'>): Promise<POISearchResponse>;
|
|
42
|
+
/**
|
|
43
|
+
* 周边搜索
|
|
44
|
+
* 搜索指定位置周边的POI
|
|
45
|
+
*
|
|
46
|
+
* @param location 中心点坐标,格式:经度,纬度
|
|
47
|
+
* @param options 可选参数
|
|
48
|
+
* @returns POI 搜索结果
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* // 搜索周边所有POI
|
|
53
|
+
* const result = await poi.searchAround('116.473168,39.993015', {
|
|
54
|
+
* radius: 1000
|
|
55
|
+
* });
|
|
56
|
+
*
|
|
57
|
+
* // 搜索周边特定类型POI
|
|
58
|
+
* const result = await poi.searchAround('116.473168,39.993015', {
|
|
59
|
+
* keywords: '餐厅',
|
|
60
|
+
* radius: 500,
|
|
61
|
+
* sortrule: 'distance'
|
|
62
|
+
* });
|
|
63
|
+
*
|
|
64
|
+
* // 搜索周边肯德基
|
|
65
|
+
* const result = await poi.searchAround('116.473168,39.993015', {
|
|
66
|
+
* keywords: '肯德基',
|
|
67
|
+
* types: '050301', // 中餐厅
|
|
68
|
+
* radius: 2000,
|
|
69
|
+
* page_size: 10,
|
|
70
|
+
* show_fields: 'business,photos'
|
|
71
|
+
* });
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
searchAround(location: string | {
|
|
75
|
+
longitude: number;
|
|
76
|
+
latitude: number;
|
|
77
|
+
}, options?: Omit<POIAroundParams, 'location'>): Promise<POISearchResponse>;
|
|
78
|
+
/**
|
|
79
|
+
* 多边形搜索
|
|
80
|
+
* 搜索指定多边形区域内的POI
|
|
81
|
+
*
|
|
82
|
+
* @param polygon 多边形坐标,格式:经度1,纬度1|经度2,纬度2|...
|
|
83
|
+
* @param options 可选参数
|
|
84
|
+
* @returns POI 搜索结果
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* const result = await poi.searchPolygon(
|
|
89
|
+
* '116.460656,39.996059|116.469543,39.996059|116.469543,39.989723',
|
|
90
|
+
* {
|
|
91
|
+
* keywords: '酒店',
|
|
92
|
+
* offset: 20
|
|
93
|
+
* }
|
|
94
|
+
* );
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
searchPolygon(polygon: string, options?: Omit<POIPolygonParams, 'polygon'>): Promise<POISearchResponse>;
|
|
98
|
+
/**
|
|
99
|
+
* POI详情查询
|
|
100
|
+
* 根据POI ID查询详细信息
|
|
101
|
+
*
|
|
102
|
+
* @param id POI ID(最多可以传入10个 id,多个 id 之间用"|"分隔)
|
|
103
|
+
* @param show_fields 返回结果控制,可选值:children, business, indoor, navi, photos
|
|
104
|
+
* @returns POI 详情
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* // 单个POI详情
|
|
109
|
+
* const result = await poi.getDetail('B000A8VE1H', 'business,photos');
|
|
110
|
+
* console.log(result.pois[0].name);
|
|
111
|
+
*
|
|
112
|
+
* // 批量查询(最多10个)
|
|
113
|
+
* const result = await poi.getDetail('B000A8VE1H|B0FFKEPXS2', 'business,photos');
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
getDetail(id: string, show_fields?: string): Promise<POISearchResponse>;
|
|
117
|
+
/**
|
|
118
|
+
* 批量查询POI详情
|
|
119
|
+
*
|
|
120
|
+
* @param ids POI ID列表(最多10个)
|
|
121
|
+
* @param show_fields 返回结果控制
|
|
122
|
+
* @returns POI 详情列表
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* const result = await poi.batchGetDetail([
|
|
127
|
+
* 'B000A8VE1H',
|
|
128
|
+
* 'B000A8VE2I'
|
|
129
|
+
* ], 'business,photos');
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
batchGetDetail(ids: string[], show_fields?: string): Promise<POISearchResponse>;
|
|
133
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 高德地图 Web API - POI 搜索服务
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.POIService = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* POI 搜索服务
|
|
9
|
+
*/
|
|
10
|
+
class POIService {
|
|
11
|
+
constructor(client) {
|
|
12
|
+
this.client = client;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 关键字搜索
|
|
16
|
+
* 根据关键字搜索POI
|
|
17
|
+
*
|
|
18
|
+
* @param keywords 查询关键字(keywords 或 types 二选一必填)
|
|
19
|
+
* @param options 可选参数
|
|
20
|
+
* @returns POI 搜索结果
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* // 基础搜索
|
|
25
|
+
* const result = await poi.search('肯德基', { region: '北京市' });
|
|
26
|
+
*
|
|
27
|
+
* // 限制城市
|
|
28
|
+
* const result = await poi.search('肯德基', {
|
|
29
|
+
* region: '北京市',
|
|
30
|
+
* city_limit: true,
|
|
31
|
+
* page_size: 20,
|
|
32
|
+
* page_num: 1
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* // 指定类型搜索
|
|
36
|
+
* const result = await poi.search('', {
|
|
37
|
+
* types: '050000', // 餐饮服务
|
|
38
|
+
* region: '北京市',
|
|
39
|
+
* show_fields: 'children,business,photos'
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
async search(keywords, options) {
|
|
44
|
+
const params = {
|
|
45
|
+
keywords,
|
|
46
|
+
...options,
|
|
47
|
+
};
|
|
48
|
+
return this.client.request('/v5/place/text', params);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 周边搜索
|
|
52
|
+
* 搜索指定位置周边的POI
|
|
53
|
+
*
|
|
54
|
+
* @param location 中心点坐标,格式:经度,纬度
|
|
55
|
+
* @param options 可选参数
|
|
56
|
+
* @returns POI 搜索结果
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* // 搜索周边所有POI
|
|
61
|
+
* const result = await poi.searchAround('116.473168,39.993015', {
|
|
62
|
+
* radius: 1000
|
|
63
|
+
* });
|
|
64
|
+
*
|
|
65
|
+
* // 搜索周边特定类型POI
|
|
66
|
+
* const result = await poi.searchAround('116.473168,39.993015', {
|
|
67
|
+
* keywords: '餐厅',
|
|
68
|
+
* radius: 500,
|
|
69
|
+
* sortrule: 'distance'
|
|
70
|
+
* });
|
|
71
|
+
*
|
|
72
|
+
* // 搜索周边肯德基
|
|
73
|
+
* const result = await poi.searchAround('116.473168,39.993015', {
|
|
74
|
+
* keywords: '肯德基',
|
|
75
|
+
* types: '050301', // 中餐厅
|
|
76
|
+
* radius: 2000,
|
|
77
|
+
* page_size: 10,
|
|
78
|
+
* show_fields: 'business,photos'
|
|
79
|
+
* });
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
async searchAround(location, options) {
|
|
83
|
+
// 处理坐标参数
|
|
84
|
+
let locationStr;
|
|
85
|
+
if (typeof location === 'string') {
|
|
86
|
+
locationStr = location;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
locationStr = `${location.longitude},${location.latitude}`;
|
|
90
|
+
}
|
|
91
|
+
const params = {
|
|
92
|
+
location: locationStr,
|
|
93
|
+
...options,
|
|
94
|
+
};
|
|
95
|
+
return this.client.request('/v5/place/around', params);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* 多边形搜索
|
|
99
|
+
* 搜索指定多边形区域内的POI
|
|
100
|
+
*
|
|
101
|
+
* @param polygon 多边形坐标,格式:经度1,纬度1|经度2,纬度2|...
|
|
102
|
+
* @param options 可选参数
|
|
103
|
+
* @returns POI 搜索结果
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```typescript
|
|
107
|
+
* const result = await poi.searchPolygon(
|
|
108
|
+
* '116.460656,39.996059|116.469543,39.996059|116.469543,39.989723',
|
|
109
|
+
* {
|
|
110
|
+
* keywords: '酒店',
|
|
111
|
+
* offset: 20
|
|
112
|
+
* }
|
|
113
|
+
* );
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
async searchPolygon(polygon, options) {
|
|
117
|
+
const params = {
|
|
118
|
+
polygon,
|
|
119
|
+
...options,
|
|
120
|
+
};
|
|
121
|
+
return this.client.request('/v5/place/polygon', params);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* POI详情查询
|
|
125
|
+
* 根据POI ID查询详细信息
|
|
126
|
+
*
|
|
127
|
+
* @param id POI ID(最多可以传入10个 id,多个 id 之间用"|"分隔)
|
|
128
|
+
* @param show_fields 返回结果控制,可选值:children, business, indoor, navi, photos
|
|
129
|
+
* @returns POI 详情
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```typescript
|
|
133
|
+
* // 单个POI详情
|
|
134
|
+
* const result = await poi.getDetail('B000A8VE1H', 'business,photos');
|
|
135
|
+
* console.log(result.pois[0].name);
|
|
136
|
+
*
|
|
137
|
+
* // 批量查询(最多10个)
|
|
138
|
+
* const result = await poi.getDetail('B000A8VE1H|B0FFKEPXS2', 'business,photos');
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
async getDetail(id, show_fields) {
|
|
142
|
+
const params = {
|
|
143
|
+
id,
|
|
144
|
+
show_fields,
|
|
145
|
+
};
|
|
146
|
+
return this.client.request('/v5/place/detail', params);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* 批量查询POI详情
|
|
150
|
+
*
|
|
151
|
+
* @param ids POI ID列表(最多10个)
|
|
152
|
+
* @param show_fields 返回结果控制
|
|
153
|
+
* @returns POI 详情列表
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```typescript
|
|
157
|
+
* const result = await poi.batchGetDetail([
|
|
158
|
+
* 'B000A8VE1H',
|
|
159
|
+
* 'B000A8VE2I'
|
|
160
|
+
* ], 'business,photos');
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
async batchGetDetail(ids, show_fields) {
|
|
164
|
+
if (ids.length > 10) {
|
|
165
|
+
throw new Error('批量查询最多支持10个POI ID');
|
|
166
|
+
}
|
|
167
|
+
const params = {
|
|
168
|
+
id: ids.join('|'),
|
|
169
|
+
show_fields,
|
|
170
|
+
};
|
|
171
|
+
return this.client.request('/v5/place/detail', params);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
exports.POIService = POIService;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { GaodeWebAPIClient } from '../utils/client';
|
|
2
|
+
import type { Coordinate, DrivingRouteParams, DrivingRouteResponse, WalkingRouteParams, WalkingRouteResponse, BicyclingRouteParams, BicyclingRouteResponse, ElectricBikeRouteParams, ElectricBikeRouteResponse, TransitRouteParams, TransitRouteResponse } from '../types/route.types';
|
|
3
|
+
/**
|
|
4
|
+
* 路径规划服务
|
|
5
|
+
* 提供驾车、步行、骑行、电动车、公交等多种出行方式的路径规划
|
|
6
|
+
*/
|
|
7
|
+
export declare class RouteService {
|
|
8
|
+
private client;
|
|
9
|
+
constructor(client: GaodeWebAPIClient);
|
|
10
|
+
/**
|
|
11
|
+
* 坐标转换辅助方法
|
|
12
|
+
*/
|
|
13
|
+
private formatCoordinate;
|
|
14
|
+
/**
|
|
15
|
+
* 驾车路径规划
|
|
16
|
+
* @param origin 出发点坐标
|
|
17
|
+
* @param destination 目的地坐标
|
|
18
|
+
* @param options 可选参数
|
|
19
|
+
* @returns 驾车路径规划结果
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* // 基础用法
|
|
24
|
+
* const result = await api.route.driving(
|
|
25
|
+
* '116.481028,39.989643',
|
|
26
|
+
* '116.434446,39.90816'
|
|
27
|
+
* );
|
|
28
|
+
*
|
|
29
|
+
* // 带途经点和策略(新版 V5 API)
|
|
30
|
+
* const result = await api.route.driving(
|
|
31
|
+
* { longitude: 116.481028, latitude: 39.989643 },
|
|
32
|
+
* { longitude: 116.434446, latitude: 39.90816 },
|
|
33
|
+
* {
|
|
34
|
+
* waypoints: ['116.45,39.95', '116.46,39.94'],
|
|
35
|
+
* strategy: DrivingStrategy.AVOID_JAM,
|
|
36
|
+
* show_fields: 'cost,navi,polyline',
|
|
37
|
+
* plate: '京AHA322',
|
|
38
|
+
* cartype: 0
|
|
39
|
+
* }
|
|
40
|
+
* );
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
driving(origin: Coordinate, destination: Coordinate, options?: Omit<DrivingRouteParams, 'origin' | 'destination'>): Promise<DrivingRouteResponse>;
|
|
44
|
+
/**
|
|
45
|
+
* 步行路径规划
|
|
46
|
+
* @param origin 出发点坐标
|
|
47
|
+
* @param destination 目的地坐标
|
|
48
|
+
* @param options 可选参数
|
|
49
|
+
* @returns 步行路径规划结果
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const result = await api.route.walking(
|
|
54
|
+
* '116.481028,39.989643',
|
|
55
|
+
* '116.434446,39.90816'
|
|
56
|
+
* );
|
|
57
|
+
*
|
|
58
|
+
* console.log(`步行距离:${result.route.paths[0].distance}米`);
|
|
59
|
+
* console.log(`预计时间:${result.route.paths[0].duration}秒`);
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
walking(origin: Coordinate, destination: Coordinate, options?: Omit<WalkingRouteParams, 'origin' | 'destination'>): Promise<WalkingRouteResponse>;
|
|
63
|
+
/**
|
|
64
|
+
* 骑行路径规划
|
|
65
|
+
* @param origin 出发点坐标
|
|
66
|
+
* @param destination 目的地坐标
|
|
67
|
+
* @param options 可选参数
|
|
68
|
+
* @returns 骑行路径规划结果
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* const result = await api.route.bicycling(
|
|
73
|
+
* '116.481028,39.989643',
|
|
74
|
+
* '116.434446,39.90816',
|
|
75
|
+
* {
|
|
76
|
+
* alternative_route: 2,
|
|
77
|
+
* show_fields: 'cost,navi,polyline'
|
|
78
|
+
* }
|
|
79
|
+
* );
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
bicycling(origin: Coordinate, destination: Coordinate, options?: Omit<BicyclingRouteParams, 'origin' | 'destination'>): Promise<BicyclingRouteResponse>;
|
|
83
|
+
/**
|
|
84
|
+
* 电动车路径规划
|
|
85
|
+
* @param origin 出发点坐标
|
|
86
|
+
* @param destination 目的地坐标
|
|
87
|
+
* @param options 可选参数
|
|
88
|
+
* @returns 电动车路径规划结果
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* const result = await api.route.electr icBike(
|
|
93
|
+
* '116.481028,39.989643',
|
|
94
|
+
* '116.434446,39.90816'
|
|
95
|
+
* );
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
electricBike(origin: Coordinate, destination: Coordinate, options?: Omit<ElectricBikeRouteParams, 'origin' | 'destination'>): Promise<ElectricBikeRouteResponse>;
|
|
99
|
+
/**
|
|
100
|
+
* 公交路径规划(新版 V5 API)
|
|
101
|
+
* @param origin 出发点坐标
|
|
102
|
+
* @param destination 目的地坐标
|
|
103
|
+
* @param city1 起点所在城市(citycode,必填)
|
|
104
|
+
* @param city2 目的地所在城市(citycode,必填)
|
|
105
|
+
* @param options 可选参数
|
|
106
|
+
* @returns 公交路径规划结果
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```typescript
|
|
110
|
+
* // 同城公交(北京市 citycode: 010)
|
|
111
|
+
* const result = await api.route.transit(
|
|
112
|
+
* '116.481028,39.989643',
|
|
113
|
+
* '116.434446,39.90816',
|
|
114
|
+
* '010',
|
|
115
|
+
* '010',
|
|
116
|
+
* {
|
|
117
|
+
* strategy: TransitStrategy.RECOMMENDED,
|
|
118
|
+
* show_fields: 'cost,polyline'
|
|
119
|
+
* }
|
|
120
|
+
* );
|
|
121
|
+
*
|
|
122
|
+
* // 跨城公交(北京到上海,上海 citycode: 021)
|
|
123
|
+
* const result = await api.route.transit(
|
|
124
|
+
* '116.481028,39.989643',
|
|
125
|
+
* '121.472644,31.231706',
|
|
126
|
+
* '010',
|
|
127
|
+
* '021',
|
|
128
|
+
* {
|
|
129
|
+
* strategy: TransitStrategy.TIME_FIRST,
|
|
130
|
+
* AlternativeRoute: 3
|
|
131
|
+
* }
|
|
132
|
+
* );
|
|
133
|
+
*
|
|
134
|
+
* // 地铁图模式(起终点都是地铁站,需要提供 POI ID)
|
|
135
|
+
* const result = await api.route.transit(
|
|
136
|
+
* '116.481028,39.989643',
|
|
137
|
+
* '116.434446,39.90816',
|
|
138
|
+
* '010',
|
|
139
|
+
* '010',
|
|
140
|
+
* {
|
|
141
|
+
* strategy: TransitStrategy.SUBWAY_MAP,
|
|
142
|
+
* originpoi: 'B000A83M2Z',
|
|
143
|
+
* destinationpoi: 'B000A83M30'
|
|
144
|
+
* }
|
|
145
|
+
* );
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
transit(origin: Coordinate, destination: Coordinate, city1: string, city2: string, options?: Omit<TransitRouteParams, 'origin' | 'destination' | 'city1' | 'city2'>): Promise<TransitRouteResponse>;
|
|
149
|
+
}
|