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,203 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RouteService = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* 路径规划服务
|
|
6
|
+
* 提供驾车、步行、骑行、电动车、公交等多种出行方式的路径规划
|
|
7
|
+
*/
|
|
8
|
+
class RouteService {
|
|
9
|
+
constructor(client) {
|
|
10
|
+
this.client = client;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 坐标转换辅助方法
|
|
14
|
+
*/
|
|
15
|
+
formatCoordinate(coord) {
|
|
16
|
+
if (typeof coord === 'string') {
|
|
17
|
+
return coord;
|
|
18
|
+
}
|
|
19
|
+
return `${coord.longitude},${coord.latitude}`;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 驾车路径规划
|
|
23
|
+
* @param origin 出发点坐标
|
|
24
|
+
* @param destination 目的地坐标
|
|
25
|
+
* @param options 可选参数
|
|
26
|
+
* @returns 驾车路径规划结果
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* // 基础用法
|
|
31
|
+
* const result = await api.route.driving(
|
|
32
|
+
* '116.481028,39.989643',
|
|
33
|
+
* '116.434446,39.90816'
|
|
34
|
+
* );
|
|
35
|
+
*
|
|
36
|
+
* // 带途经点和策略(新版 V5 API)
|
|
37
|
+
* const result = await api.route.driving(
|
|
38
|
+
* { longitude: 116.481028, latitude: 39.989643 },
|
|
39
|
+
* { longitude: 116.434446, latitude: 39.90816 },
|
|
40
|
+
* {
|
|
41
|
+
* waypoints: ['116.45,39.95', '116.46,39.94'],
|
|
42
|
+
* strategy: DrivingStrategy.AVOID_JAM,
|
|
43
|
+
* show_fields: 'cost,navi,polyline',
|
|
44
|
+
* plate: '京AHA322',
|
|
45
|
+
* cartype: 0
|
|
46
|
+
* }
|
|
47
|
+
* );
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
async driving(origin, destination, options) {
|
|
51
|
+
const params = {
|
|
52
|
+
origin: this.formatCoordinate(origin),
|
|
53
|
+
destination: this.formatCoordinate(destination),
|
|
54
|
+
...options,
|
|
55
|
+
};
|
|
56
|
+
// 处理途经点
|
|
57
|
+
if (options?.waypoints) {
|
|
58
|
+
if (Array.isArray(options.waypoints)) {
|
|
59
|
+
params.waypoints = options.waypoints.map(wp => this.formatCoordinate(wp)).join(';');
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
params.waypoints = this.formatCoordinate(options.waypoints);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return this.client.request('/v5/direction/driving', params);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* 步行路径规划
|
|
69
|
+
* @param origin 出发点坐标
|
|
70
|
+
* @param destination 目的地坐标
|
|
71
|
+
* @param options 可选参数
|
|
72
|
+
* @returns 步行路径规划结果
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* const result = await api.route.walking(
|
|
77
|
+
* '116.481028,39.989643',
|
|
78
|
+
* '116.434446,39.90816'
|
|
79
|
+
* );
|
|
80
|
+
*
|
|
81
|
+
* console.log(`步行距离:${result.route.paths[0].distance}米`);
|
|
82
|
+
* console.log(`预计时间:${result.route.paths[0].duration}秒`);
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
async walking(origin, destination, options) {
|
|
86
|
+
const params = {
|
|
87
|
+
origin: this.formatCoordinate(origin),
|
|
88
|
+
destination: this.formatCoordinate(destination),
|
|
89
|
+
...options,
|
|
90
|
+
};
|
|
91
|
+
return this.client.request('/v5/direction/walking', params);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* 骑行路径规划
|
|
95
|
+
* @param origin 出发点坐标
|
|
96
|
+
* @param destination 目的地坐标
|
|
97
|
+
* @param options 可选参数
|
|
98
|
+
* @returns 骑行路径规划结果
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* const result = await api.route.bicycling(
|
|
103
|
+
* '116.481028,39.989643',
|
|
104
|
+
* '116.434446,39.90816',
|
|
105
|
+
* {
|
|
106
|
+
* alternative_route: 2,
|
|
107
|
+
* show_fields: 'cost,navi,polyline'
|
|
108
|
+
* }
|
|
109
|
+
* );
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
async bicycling(origin, destination, options) {
|
|
113
|
+
const params = {
|
|
114
|
+
origin: this.formatCoordinate(origin),
|
|
115
|
+
destination: this.formatCoordinate(destination),
|
|
116
|
+
...options,
|
|
117
|
+
};
|
|
118
|
+
return this.client.request('/v5/direction/bicycling', params);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* 电动车路径规划
|
|
122
|
+
* @param origin 出发点坐标
|
|
123
|
+
* @param destination 目的地坐标
|
|
124
|
+
* @param options 可选参数
|
|
125
|
+
* @returns 电动车路径规划结果
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* const result = await api.route.electr icBike(
|
|
130
|
+
* '116.481028,39.989643',
|
|
131
|
+
* '116.434446,39.90816'
|
|
132
|
+
* );
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
async electricBike(origin, destination, options) {
|
|
136
|
+
const params = {
|
|
137
|
+
origin: this.formatCoordinate(origin),
|
|
138
|
+
destination: this.formatCoordinate(destination),
|
|
139
|
+
...options,
|
|
140
|
+
};
|
|
141
|
+
return this.client.request('/v5/direction/electrobike', params);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* 公交路径规划(新版 V5 API)
|
|
145
|
+
* @param origin 出发点坐标
|
|
146
|
+
* @param destination 目的地坐标
|
|
147
|
+
* @param city1 起点所在城市(citycode,必填)
|
|
148
|
+
* @param city2 目的地所在城市(citycode,必填)
|
|
149
|
+
* @param options 可选参数
|
|
150
|
+
* @returns 公交路径规划结果
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```typescript
|
|
154
|
+
* // 同城公交(北京市 citycode: 010)
|
|
155
|
+
* const result = await api.route.transit(
|
|
156
|
+
* '116.481028,39.989643',
|
|
157
|
+
* '116.434446,39.90816',
|
|
158
|
+
* '010',
|
|
159
|
+
* '010',
|
|
160
|
+
* {
|
|
161
|
+
* strategy: TransitStrategy.RECOMMENDED,
|
|
162
|
+
* show_fields: 'cost,polyline'
|
|
163
|
+
* }
|
|
164
|
+
* );
|
|
165
|
+
*
|
|
166
|
+
* // 跨城公交(北京到上海,上海 citycode: 021)
|
|
167
|
+
* const result = await api.route.transit(
|
|
168
|
+
* '116.481028,39.989643',
|
|
169
|
+
* '121.472644,31.231706',
|
|
170
|
+
* '010',
|
|
171
|
+
* '021',
|
|
172
|
+
* {
|
|
173
|
+
* strategy: TransitStrategy.TIME_FIRST,
|
|
174
|
+
* AlternativeRoute: 3
|
|
175
|
+
* }
|
|
176
|
+
* );
|
|
177
|
+
*
|
|
178
|
+
* // 地铁图模式(起终点都是地铁站,需要提供 POI ID)
|
|
179
|
+
* const result = await api.route.transit(
|
|
180
|
+
* '116.481028,39.989643',
|
|
181
|
+
* '116.434446,39.90816',
|
|
182
|
+
* '010',
|
|
183
|
+
* '010',
|
|
184
|
+
* {
|
|
185
|
+
* strategy: TransitStrategy.SUBWAY_MAP,
|
|
186
|
+
* originpoi: 'B000A83M2Z',
|
|
187
|
+
* destinationpoi: 'B000A83M30'
|
|
188
|
+
* }
|
|
189
|
+
* );
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
async transit(origin, destination, city1, city2, options) {
|
|
193
|
+
const params = {
|
|
194
|
+
origin: this.formatCoordinate(origin),
|
|
195
|
+
destination: this.formatCoordinate(destination),
|
|
196
|
+
city1,
|
|
197
|
+
city2,
|
|
198
|
+
...options,
|
|
199
|
+
};
|
|
200
|
+
return this.client.request('/v5/direction/transit/integrated', params);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
exports.RouteService = RouteService;
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 高德地图 Web API - 地理编码类型定义
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* 逆地理编码请求参数
|
|
6
|
+
*/
|
|
7
|
+
export interface RegeocodeParams {
|
|
8
|
+
/** 经纬度坐标,格式:经度,纬度 */
|
|
9
|
+
location: string;
|
|
10
|
+
/**
|
|
11
|
+
* 返回附近POI类型
|
|
12
|
+
* 以下内容需要 extensions=all 时才生效
|
|
13
|
+
* 支持传入POI TYPECODE及名称;支持传入多个POI类型,多值间用"|"分隔
|
|
14
|
+
* 可以参考POI分类码表
|
|
15
|
+
*/
|
|
16
|
+
poitype?: string;
|
|
17
|
+
/**
|
|
18
|
+
* 搜索半径,默认1000米
|
|
19
|
+
* radius取值范围在0-3000,单位:米
|
|
20
|
+
*/
|
|
21
|
+
radius?: number;
|
|
22
|
+
/**
|
|
23
|
+
* 返回结果控制
|
|
24
|
+
* base: 返回基本地址信息
|
|
25
|
+
* all: 返回地址信息及附近POI、道路、道路交叉口信息
|
|
26
|
+
* @default 'base'
|
|
27
|
+
*/
|
|
28
|
+
extensions?: 'base' | 'all';
|
|
29
|
+
/**
|
|
30
|
+
* 道路等级
|
|
31
|
+
* 以下内容需要 extensions=all 时才生效
|
|
32
|
+
* 可选值:0,1
|
|
33
|
+
* 当roadlevel=0时,显示所有道路
|
|
34
|
+
* 当roadlevel=1时,过滤非主干道路,仅输出主干道路数据
|
|
35
|
+
*/
|
|
36
|
+
roadlevel?: 0 | 1;
|
|
37
|
+
/**
|
|
38
|
+
* 批量查询控制
|
|
39
|
+
* batch=true时进行批量查询操作
|
|
40
|
+
*/
|
|
41
|
+
batch?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* 是否优化POI返回顺序
|
|
44
|
+
* 以下内容需要 extensions=all 时才生效
|
|
45
|
+
* 0:不对召回的排序策略进行干扰
|
|
46
|
+
* 1:综合大数据分析将居家相关的POI内容优先返回
|
|
47
|
+
* 2:综合大数据分析将公司相关的POI内容优先返回
|
|
48
|
+
*/
|
|
49
|
+
homeorcorp?: 0 | 1 | 2;
|
|
50
|
+
/**
|
|
51
|
+
* 数字签名
|
|
52
|
+
* 可选,用于数字签名验证
|
|
53
|
+
*/
|
|
54
|
+
sig?: string;
|
|
55
|
+
/**
|
|
56
|
+
* 返回数据格式类型
|
|
57
|
+
* 可选值:JSON,XML
|
|
58
|
+
* @default 'JSON'
|
|
59
|
+
*/
|
|
60
|
+
output?: 'JSON' | 'XML' | 'json' | 'xml';
|
|
61
|
+
/**
|
|
62
|
+
* 回调函数
|
|
63
|
+
* 此参数只在output参数设置为JSON时有效
|
|
64
|
+
*/
|
|
65
|
+
callback?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* 地址组成元素
|
|
69
|
+
*/
|
|
70
|
+
export interface AddressComponent {
|
|
71
|
+
/** 坐标点所在国家名称,例如:中国 */
|
|
72
|
+
country: string;
|
|
73
|
+
/** 坐标点所在省名称,例如:北京市 */
|
|
74
|
+
province: string;
|
|
75
|
+
/**
|
|
76
|
+
* 坐标点所在城市名称,例如:北京市
|
|
77
|
+
* 注意:当城市是省直辖县时返回为空,以及城市为北京、上海、天津、重庆四个直辖市时,该字段返回为空
|
|
78
|
+
*/
|
|
79
|
+
city: string | string[];
|
|
80
|
+
/** 城市编码,例如:010 */
|
|
81
|
+
citycode: string;
|
|
82
|
+
/** 坐标点所在区,例如:海淀区 */
|
|
83
|
+
district: string;
|
|
84
|
+
/** 行政区编码,例如:110108 */
|
|
85
|
+
adcode: string;
|
|
86
|
+
/** 坐标点所在乡镇/街道(此街道为社区街道,不是道路信息),例如:燕园街道 */
|
|
87
|
+
township: string;
|
|
88
|
+
/** 乡镇街道编码,例如:110101001000 */
|
|
89
|
+
towncode: string;
|
|
90
|
+
/** 街道,例如:中关村北二条 */
|
|
91
|
+
street: string;
|
|
92
|
+
/** 门牌号,例如:3号 */
|
|
93
|
+
number: string;
|
|
94
|
+
/** 所属海域信息,例如:渤海 */
|
|
95
|
+
seaArea?: string;
|
|
96
|
+
/** 社区信息 */
|
|
97
|
+
neighborhood: {
|
|
98
|
+
/** 社区名称,例如:北京大学 */
|
|
99
|
+
name: string;
|
|
100
|
+
/** POI类型,例如:科教文化服务;学校;高等院校 */
|
|
101
|
+
type: string;
|
|
102
|
+
};
|
|
103
|
+
/** 楼信息 */
|
|
104
|
+
building: {
|
|
105
|
+
/** 建筑名称,例如:万达广场 */
|
|
106
|
+
name: string;
|
|
107
|
+
/** 类型,例如:科教文化服务;学校;高等院校 */
|
|
108
|
+
type: string;
|
|
109
|
+
};
|
|
110
|
+
/** 门牌信息 */
|
|
111
|
+
streetNumber: {
|
|
112
|
+
/** 街道名称,例如:中关村北二条 */
|
|
113
|
+
street: string;
|
|
114
|
+
/** 门牌号,例如:3号 */
|
|
115
|
+
number: string;
|
|
116
|
+
/** 坐标点:经度,纬度 */
|
|
117
|
+
location: string;
|
|
118
|
+
/** 方向:坐标点所处街道方位 */
|
|
119
|
+
direction: string;
|
|
120
|
+
/** 门牌地址到请求坐标的距离,单位:米 */
|
|
121
|
+
distance: string;
|
|
122
|
+
};
|
|
123
|
+
/** 经纬度所属商圈列表 */
|
|
124
|
+
businessAreas: Array<{
|
|
125
|
+
/** 商圈中心点经纬度 */
|
|
126
|
+
location: string;
|
|
127
|
+
/** 商圈名称,例如:颐和园 */
|
|
128
|
+
name: string;
|
|
129
|
+
/** 商圈所在区域的adcode,例如:朝阳区/海淀区 */
|
|
130
|
+
id: string;
|
|
131
|
+
}>;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* 道路信息
|
|
135
|
+
*/
|
|
136
|
+
export interface Road {
|
|
137
|
+
/** 道路id */
|
|
138
|
+
id: string;
|
|
139
|
+
/** 道路名称,例如:北四环西路辅路 */
|
|
140
|
+
name: string;
|
|
141
|
+
/** 道路到请求坐标的距离,单位:米 */
|
|
142
|
+
distance: string;
|
|
143
|
+
/** 方位,输入点相对于道路的方位,例如:南 */
|
|
144
|
+
direction: string;
|
|
145
|
+
/** 坐标点:经度,纬度 */
|
|
146
|
+
location: string;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* 道路交叉口
|
|
150
|
+
*/
|
|
151
|
+
export interface Roadinter {
|
|
152
|
+
/** 第一条道路id */
|
|
153
|
+
first_id: string;
|
|
154
|
+
/** 第一条道路名称,例如:北四环西路辅路 */
|
|
155
|
+
first_name: string;
|
|
156
|
+
/** 第二条道路id */
|
|
157
|
+
second_id: string;
|
|
158
|
+
/** 第二条道路名称,例如:中关村北大街 */
|
|
159
|
+
second_name: string;
|
|
160
|
+
/** 交叉路口到请求坐标的距离,单位:米 */
|
|
161
|
+
distance: string;
|
|
162
|
+
/** 方位,输入点相对于交叉路口的方位,例如:东南 */
|
|
163
|
+
direction: string;
|
|
164
|
+
/** 坐标点:经度,纬度 */
|
|
165
|
+
location: string;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* POI 信息(兴趣点)
|
|
169
|
+
*/
|
|
170
|
+
export interface POI {
|
|
171
|
+
/** POI的id */
|
|
172
|
+
id: string;
|
|
173
|
+
/** POI名称,例如:北京大学 */
|
|
174
|
+
name: string;
|
|
175
|
+
/** POI类型,例如:科教文化服务;学校;高等院校 */
|
|
176
|
+
type: string;
|
|
177
|
+
/** 电话 */
|
|
178
|
+
tel: string;
|
|
179
|
+
/** POI到请求坐标的距离,单位:米 */
|
|
180
|
+
distance: string;
|
|
181
|
+
/** 方位,输入点相对于POI的方位,例如:东北 */
|
|
182
|
+
direction: string;
|
|
183
|
+
/** POI地址信息 */
|
|
184
|
+
address: string;
|
|
185
|
+
/** 坐标点:经度,纬度 */
|
|
186
|
+
location: string;
|
|
187
|
+
/** 商圈名称,例如:中关村 */
|
|
188
|
+
businessarea: string;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* AOI 信息(Area of Interest - 面状地物)
|
|
192
|
+
* AOI 是一个具有明确边界的区域,通常是商圈、景区等
|
|
193
|
+
*/
|
|
194
|
+
export interface AOI {
|
|
195
|
+
/** AOI的id */
|
|
196
|
+
id: string;
|
|
197
|
+
/** AOI名称,例如:北京大学 */
|
|
198
|
+
name: string;
|
|
199
|
+
/** 所属adcode,例如:110108 */
|
|
200
|
+
adcode: string;
|
|
201
|
+
/** AOI中心点坐标:经度,纬度 */
|
|
202
|
+
location: string;
|
|
203
|
+
/** 面积,单位:平方米 */
|
|
204
|
+
area: string;
|
|
205
|
+
/**
|
|
206
|
+
* 距离,单位:米
|
|
207
|
+
* 0 表示在AOI内,其他值表示距离AOI的距离
|
|
208
|
+
*/
|
|
209
|
+
distance: string;
|
|
210
|
+
/** AOI类型,例如:110101(科教文化类) */
|
|
211
|
+
type: string;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* 逆地理编码结果
|
|
215
|
+
*/
|
|
216
|
+
export interface Regeocode {
|
|
217
|
+
/** 结构化地址信息 */
|
|
218
|
+
formatted_address: string;
|
|
219
|
+
/** 地址组成元素 */
|
|
220
|
+
addressComponent: AddressComponent;
|
|
221
|
+
/** 道路信息列表 */
|
|
222
|
+
roads?: Road[];
|
|
223
|
+
/** 道路交叉口列表 */
|
|
224
|
+
roadinters?: Roadinter[];
|
|
225
|
+
/** POI信息列表 */
|
|
226
|
+
pois?: POI[];
|
|
227
|
+
/** AOI信息列表 */
|
|
228
|
+
aois?: AOI[];
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* 逆地理编码响应结果
|
|
232
|
+
*/
|
|
233
|
+
export interface RegeocodeResponse {
|
|
234
|
+
/** 状态码:1-成功,0-失败 */
|
|
235
|
+
status: string;
|
|
236
|
+
/** 状态说明 */
|
|
237
|
+
info: string;
|
|
238
|
+
/** 状态码说明 */
|
|
239
|
+
infocode: string;
|
|
240
|
+
/** 逆地理编码结果 */
|
|
241
|
+
regeocode: Regeocode;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* 地理编码请求参数
|
|
245
|
+
*/
|
|
246
|
+
export interface GeocodeParams {
|
|
247
|
+
/**
|
|
248
|
+
* 结构化地址信息
|
|
249
|
+
* 规则:结构化地址,如:北京市朝阳区阜通东大街6号
|
|
250
|
+
* 注意:地址信息越完整,解析精度越高
|
|
251
|
+
*/
|
|
252
|
+
address: string;
|
|
253
|
+
/**
|
|
254
|
+
* 指定查询的城市
|
|
255
|
+
* 可选值:城市中文、中文全拼、citycode、adcode
|
|
256
|
+
* 例如:北京市/beijing/010/110000
|
|
257
|
+
* 注意:当城市为北京、上海、天津、重庆时,可以不用传此参数
|
|
258
|
+
*/
|
|
259
|
+
city?: string;
|
|
260
|
+
/**
|
|
261
|
+
* 批量查询控制
|
|
262
|
+
* batch=true时进行批量查询操作
|
|
263
|
+
* 注意:批量查询时,address可传入多个地址,用"|"分割,最多支持10个
|
|
264
|
+
*/
|
|
265
|
+
batch?: boolean;
|
|
266
|
+
/**
|
|
267
|
+
* 数字签名
|
|
268
|
+
* 若用户申请的key为签名校验型key,则需要传递此参数
|
|
269
|
+
*/
|
|
270
|
+
sig?: string;
|
|
271
|
+
/**
|
|
272
|
+
* 返回数据格式类型
|
|
273
|
+
* 可选值:JSON、XML
|
|
274
|
+
* @default 'JSON'
|
|
275
|
+
*/
|
|
276
|
+
output?: 'JSON' | 'XML';
|
|
277
|
+
/**
|
|
278
|
+
* 回调函数
|
|
279
|
+
* callback值是用户定义的函数名称,此参数只在output参数设置为JSON时有效
|
|
280
|
+
*/
|
|
281
|
+
callback?: string;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* 地理编码结果
|
|
285
|
+
*/
|
|
286
|
+
export interface Geocode {
|
|
287
|
+
/** 结构化地址信息 */
|
|
288
|
+
formatted_address: string;
|
|
289
|
+
/** 所属国家 */
|
|
290
|
+
country: string;
|
|
291
|
+
/** 地址所在的省份名 */
|
|
292
|
+
province: string;
|
|
293
|
+
/** 地址所在的城市名 */
|
|
294
|
+
city: string;
|
|
295
|
+
/** 城市编码 */
|
|
296
|
+
citycode: string;
|
|
297
|
+
/** 地址所在的区 */
|
|
298
|
+
district: string;
|
|
299
|
+
/** 区域编码 */
|
|
300
|
+
adcode: string;
|
|
301
|
+
/** 乡镇 */
|
|
302
|
+
township: string;
|
|
303
|
+
/** 街道 */
|
|
304
|
+
street: string;
|
|
305
|
+
/** 门牌 */
|
|
306
|
+
number: string;
|
|
307
|
+
/** 坐标点,经度,纬度 */
|
|
308
|
+
location: string;
|
|
309
|
+
/** 匹配级别 */
|
|
310
|
+
level: string;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* 地理编码响应结果
|
|
314
|
+
*/
|
|
315
|
+
export interface GeocodeResponse {
|
|
316
|
+
/** 状态码:1-成功,0-失败 */
|
|
317
|
+
status: string;
|
|
318
|
+
/** 状态说明 */
|
|
319
|
+
info: string;
|
|
320
|
+
/** 状态码说明 */
|
|
321
|
+
infocode: string;
|
|
322
|
+
/** 地理编码结果个数 */
|
|
323
|
+
count: string;
|
|
324
|
+
/** 地理编码结果列表 */
|
|
325
|
+
geocodes: Geocode[];
|
|
326
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 高德地图 Web API - 输入提示类型定义
|
|
3
|
+
* API 文档: https://lbs.amap.com/api/webservice/guide/api/inputtips
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 输入提示请求参数
|
|
7
|
+
*/
|
|
8
|
+
export interface InputTipsParams {
|
|
9
|
+
/** 查询关键词 */
|
|
10
|
+
keywords: string;
|
|
11
|
+
/** POI 分类,多个类型用"|"分隔,可选值:POI 分类名称、分类代码 */
|
|
12
|
+
type?: string;
|
|
13
|
+
/** 坐标,格式:"X,Y"(经度,纬度),建议使用此参数,可在此位置附近优先返回搜索关键词信息 */
|
|
14
|
+
location?: string;
|
|
15
|
+
/** 搜索城市,可选值:citycode、adcode,不支持县级市。如:010/110000 */
|
|
16
|
+
city?: string;
|
|
17
|
+
/** 仅返回指定城市数据,可选值:true/false */
|
|
18
|
+
citylimit?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* 返回的数据类型,多种数据类型用"|"分隔
|
|
21
|
+
* - all: 返回所有数据类型
|
|
22
|
+
* - poi: 返回POI数据类型
|
|
23
|
+
* - bus: 返回公交站点数据类型
|
|
24
|
+
* - busline: 返回公交线路数据类型
|
|
25
|
+
*/
|
|
26
|
+
datatype?: 'all' | 'poi' | 'bus' | 'busline' | string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 输入提示项
|
|
30
|
+
*/
|
|
31
|
+
export interface InputTip {
|
|
32
|
+
/**
|
|
33
|
+
* 数据ID
|
|
34
|
+
* - 若数据为 POI 类型,则返回 POI ID
|
|
35
|
+
* - 若数据为 bus 类型,则返回 bus id
|
|
36
|
+
* - 若数据为 busline 类型,则返回 busline id
|
|
37
|
+
*/
|
|
38
|
+
id: string;
|
|
39
|
+
/** tip 名称 */
|
|
40
|
+
name: string;
|
|
41
|
+
/** 所属区域(省+市+区,直辖市为"市+区") */
|
|
42
|
+
district: string;
|
|
43
|
+
/** 区域编码(六位区县编码) */
|
|
44
|
+
adcode: string;
|
|
45
|
+
/** tip 中心点坐标,当搜索数据为 busline 类型时,此字段不返回 */
|
|
46
|
+
location?: string;
|
|
47
|
+
/** 详细地址 */
|
|
48
|
+
address?: string;
|
|
49
|
+
/**
|
|
50
|
+
* 数据类型
|
|
51
|
+
* - poi: POI点
|
|
52
|
+
* - bus: 公交站
|
|
53
|
+
* - busline: 公交线路
|
|
54
|
+
*/
|
|
55
|
+
typecode?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 输入提示响应结果
|
|
59
|
+
*/
|
|
60
|
+
export interface InputTipsResponse {
|
|
61
|
+
/** 返回状态,1:成功;0:失败 */
|
|
62
|
+
status: string;
|
|
63
|
+
/** 返回的状态信息,status 为0时返回错误原因,否则返回"OK" */
|
|
64
|
+
info: string;
|
|
65
|
+
/** 返回结果总数目 */
|
|
66
|
+
count: string;
|
|
67
|
+
/** 建议提示列表 */
|
|
68
|
+
tips: InputTip[];
|
|
69
|
+
}
|