expo-gaode-map-search 1.3.3 → 1.3.5
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 +133 -7
- package/android/src/main/java/expo/modules/gaodemap/search/ExpoGaodeMapSearchModule.kt +411 -67
- package/build/ExpoGaodeMapSearch.types.d.ts +158 -1
- package/build/ExpoGaodeMapSearch.types.js +2 -0
- package/build/ExpoGaodeMapSearchModule.d.ts +71 -1
- package/build/index.d.ts +32 -2
- package/build/index.js +36 -0
- package/ios/ExpoGaodeMapSearchModule.swift +292 -14
- package/package.json +7 -8
- package/src/ExpoGaodeMapSearch.types.ts +164 -0
- package/src/ExpoGaodeMapSearchModule.ts +86 -2
- package/src/index.ts +48 -1
|
@@ -11,7 +11,9 @@ export declare enum SearchType {
|
|
|
11
11
|
/** 多边形搜索 */
|
|
12
12
|
POLYGON = "polygon",
|
|
13
13
|
/** 输入提示 */
|
|
14
|
-
INPUT_TIPS = "inputTips"
|
|
14
|
+
INPUT_TIPS = "inputTips",
|
|
15
|
+
/** 逆地理编码 */
|
|
16
|
+
RE_GEOCODE = "reGeocode"
|
|
15
17
|
}
|
|
16
18
|
/**
|
|
17
19
|
* 坐标点
|
|
@@ -50,6 +52,161 @@ export interface POI {
|
|
|
50
52
|
adName?: string;
|
|
51
53
|
/** 区域编码 */
|
|
52
54
|
adCode?: string;
|
|
55
|
+
/**
|
|
56
|
+
* 深度信息 (Android SDK V9.4.0+ 新增)
|
|
57
|
+
* 包含评分、营业时间、人均消费等扩展信息
|
|
58
|
+
*/
|
|
59
|
+
business?: {
|
|
60
|
+
opentime?: string;
|
|
61
|
+
opentimeToday?: string;
|
|
62
|
+
rating?: string;
|
|
63
|
+
cost?: string;
|
|
64
|
+
parkingType?: string;
|
|
65
|
+
tag?: string;
|
|
66
|
+
tel?: string;
|
|
67
|
+
alias?: string;
|
|
68
|
+
businessArea?: string;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* 图片信息
|
|
72
|
+
*/
|
|
73
|
+
photos?: Array<{
|
|
74
|
+
title?: string;
|
|
75
|
+
url?: string;
|
|
76
|
+
}>;
|
|
77
|
+
/** 室内地图信息 */
|
|
78
|
+
indoor?: {
|
|
79
|
+
/** 楼层 */
|
|
80
|
+
floor?: string;
|
|
81
|
+
/** 楼层名称 */
|
|
82
|
+
floorName?: string;
|
|
83
|
+
/** POI ID */
|
|
84
|
+
poiId?: string;
|
|
85
|
+
/** 是否有室内地图 */
|
|
86
|
+
hasIndoorMap?: boolean;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* 商圈信息
|
|
91
|
+
*/
|
|
92
|
+
export interface BusinessArea {
|
|
93
|
+
/** 名称 */
|
|
94
|
+
name: string;
|
|
95
|
+
/** 中心坐标 */
|
|
96
|
+
location: Coordinates;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* 地址组成要素
|
|
100
|
+
*/
|
|
101
|
+
export interface AddressComponent {
|
|
102
|
+
/** 省名称 */
|
|
103
|
+
province: string;
|
|
104
|
+
/** 市名称 */
|
|
105
|
+
city: string;
|
|
106
|
+
/** 区名称 */
|
|
107
|
+
district: string;
|
|
108
|
+
/** 乡镇名称 */
|
|
109
|
+
township: string;
|
|
110
|
+
/** 社区名称 */
|
|
111
|
+
neighborhood: string;
|
|
112
|
+
/** 建筑名称 */
|
|
113
|
+
building: string;
|
|
114
|
+
/** 城市编码 */
|
|
115
|
+
cityCode: string;
|
|
116
|
+
/** 区域编码 */
|
|
117
|
+
adCode: string;
|
|
118
|
+
/** 门牌信息 */
|
|
119
|
+
streetNumber: {
|
|
120
|
+
/** 街道名称 */
|
|
121
|
+
street: string;
|
|
122
|
+
/** 门牌号 */
|
|
123
|
+
number: string;
|
|
124
|
+
/** 坐标点 */
|
|
125
|
+
location?: Coordinates;
|
|
126
|
+
/** 方向 */
|
|
127
|
+
direction: string;
|
|
128
|
+
/** 距离 */
|
|
129
|
+
distance: number;
|
|
130
|
+
};
|
|
131
|
+
/** 商圈列表 */
|
|
132
|
+
businessAreas?: BusinessArea[];
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* 道路信息
|
|
136
|
+
*/
|
|
137
|
+
export interface Road {
|
|
138
|
+
/** 道路ID */
|
|
139
|
+
id: string;
|
|
140
|
+
/** 道路名称 */
|
|
141
|
+
name: string;
|
|
142
|
+
/** 距离 */
|
|
143
|
+
distance: number;
|
|
144
|
+
/** 方向 */
|
|
145
|
+
direction: string;
|
|
146
|
+
/** 坐标点 */
|
|
147
|
+
location: Coordinates;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* 道路交叉口信息
|
|
151
|
+
*/
|
|
152
|
+
export interface RoadCross {
|
|
153
|
+
/** 距离 */
|
|
154
|
+
distance: number;
|
|
155
|
+
/** 方向 */
|
|
156
|
+
direction: string;
|
|
157
|
+
/** 交叉口坐标 */
|
|
158
|
+
location: Coordinates;
|
|
159
|
+
/** 第一条道路ID */
|
|
160
|
+
firstId: string;
|
|
161
|
+
/** 第一条道路名称 */
|
|
162
|
+
firstName: string;
|
|
163
|
+
/** 第二条道路ID */
|
|
164
|
+
secondId: string;
|
|
165
|
+
/** 第二条道路名称 */
|
|
166
|
+
secondName: string;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* 兴趣区域信息
|
|
170
|
+
*/
|
|
171
|
+
export interface AOI {
|
|
172
|
+
/** AOI ID */
|
|
173
|
+
id: string;
|
|
174
|
+
/** AOI 名称 */
|
|
175
|
+
name: string;
|
|
176
|
+
/** 区域编码 */
|
|
177
|
+
adCode: string;
|
|
178
|
+
/** 中心点坐标 */
|
|
179
|
+
location: Coordinates;
|
|
180
|
+
/** 面积 */
|
|
181
|
+
area: number;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* 逆地理编码选项
|
|
185
|
+
*/
|
|
186
|
+
export interface ReGeocodeOptions {
|
|
187
|
+
/** 经纬度坐标 */
|
|
188
|
+
location: Coordinates;
|
|
189
|
+
/** 搜索半径,默认 1000 米 */
|
|
190
|
+
radius?: number;
|
|
191
|
+
/** 是否返回扩展信息,默认 true */
|
|
192
|
+
requireExtension?: boolean;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* 逆地理编码结果
|
|
196
|
+
*/
|
|
197
|
+
export interface ReGeocodeResult {
|
|
198
|
+
/** 格式化地址 */
|
|
199
|
+
formattedAddress: string;
|
|
200
|
+
/** 地址组成要素 */
|
|
201
|
+
addressComponent: AddressComponent;
|
|
202
|
+
/** 兴趣点列表 */
|
|
203
|
+
pois: POI[];
|
|
204
|
+
/** 道路列表 */
|
|
205
|
+
roads: Road[];
|
|
206
|
+
/** 道路交叉口列表 */
|
|
207
|
+
roadCrosses: RoadCross[];
|
|
208
|
+
/** 兴趣区域列表 */
|
|
209
|
+
aois: AOI[];
|
|
53
210
|
}
|
|
54
211
|
/**
|
|
55
212
|
* POI 搜索选项
|
|
@@ -1,7 +1,77 @@
|
|
|
1
|
+
import { AlongSearchOptions, InputTipsOptions, InputTipsResult, NearbySearchOptions, POI, POISearchOptions, PolygonSearchOptions, ReGeocodeOptions, ReGeocodeResult, SearchResult } from './ExpoGaodeMapSearch.types';
|
|
2
|
+
declare class ExpoGaodeMapSearchModuleType {
|
|
3
|
+
/**
|
|
4
|
+
* 初始化搜索模块(可选)
|
|
5
|
+
*
|
|
6
|
+
* 如果 API Key 已通过以下方式设置,则无需调用此方法:
|
|
7
|
+
* 1. app.json 的 plugins 中配置了 iosKey(推荐)
|
|
8
|
+
* 2. 调用了 ExpoGaodeMap.initSDK()
|
|
9
|
+
* 3. 在 AppDelegate 中手动设置
|
|
10
|
+
*
|
|
11
|
+
* 此方法会在首次调用搜索功能时自动执行,手动调用可以提前检测配置问题。
|
|
12
|
+
*/
|
|
13
|
+
initSearch(): void;
|
|
14
|
+
/**
|
|
15
|
+
* 搜索 POI(兴趣点)
|
|
16
|
+
* 根据关键词和可选参数返回匹配的 POI 列表。
|
|
17
|
+
*
|
|
18
|
+
* @param options 搜索参数,包含关键词、城市、类型等
|
|
19
|
+
* @returns 匹配的 POI 列表
|
|
20
|
+
*/
|
|
21
|
+
searchPOI(options: POISearchOptions): Promise<SearchResult>;
|
|
22
|
+
/**
|
|
23
|
+
* 搜索周边 POI
|
|
24
|
+
* 根据位置和半径返回周边的 POI 列表。
|
|
25
|
+
*
|
|
26
|
+
* @param options 搜索参数,包含位置、半径、类型等
|
|
27
|
+
* @returns 周边的 POI 列表
|
|
28
|
+
*/
|
|
29
|
+
searchNearby(options: NearbySearchOptions): Promise<SearchResult>;
|
|
30
|
+
/**
|
|
31
|
+
* 搜索沿途 POI
|
|
32
|
+
* 根据路线和半径返回沿途的 POI 列表。
|
|
33
|
+
*
|
|
34
|
+
* @param options 搜索参数,包含路线、半径、类型等
|
|
35
|
+
* @returns 沿途的 POI 列表
|
|
36
|
+
*/
|
|
37
|
+
searchAlong(options: AlongSearchOptions): Promise<SearchResult>;
|
|
38
|
+
/**
|
|
39
|
+
* 搜索多边形内的 POI
|
|
40
|
+
* 根据多边形区域返回其内的 POI 列表。
|
|
41
|
+
*
|
|
42
|
+
* @param options 搜索参数,包含多边形区域、类型等
|
|
43
|
+
* @returns 多边形内的 POI 列表
|
|
44
|
+
*/
|
|
45
|
+
searchPolygon(options: PolygonSearchOptions): Promise<SearchResult>;
|
|
46
|
+
/**
|
|
47
|
+
* 获取输入提示
|
|
48
|
+
* 根据用户输入返回可能的搜索建议。
|
|
49
|
+
*
|
|
50
|
+
* @param options 输入提示参数,包含关键词、城市等
|
|
51
|
+
* @returns 输入提示结果
|
|
52
|
+
*/
|
|
53
|
+
getInputTips(options: InputTipsOptions): Promise<InputTipsResult>;
|
|
54
|
+
/**
|
|
55
|
+
* 逆地理编码
|
|
56
|
+
* 根据经纬度返回地址信息。
|
|
57
|
+
*
|
|
58
|
+
* @param options 逆地理编码参数,包含经纬度等
|
|
59
|
+
* @returns 逆地理编码结果
|
|
60
|
+
*/
|
|
61
|
+
reGeocode(options: ReGeocodeOptions): Promise<ReGeocodeResult>;
|
|
62
|
+
/**
|
|
63
|
+
* 获取 POI 详情
|
|
64
|
+
* 根据 POI ID 返回详细信息。
|
|
65
|
+
*
|
|
66
|
+
* @param id POI 唯一标识符
|
|
67
|
+
* @returns POI 详情
|
|
68
|
+
*/
|
|
69
|
+
getPoiDetail(id: string): Promise<POI>;
|
|
70
|
+
}
|
|
1
71
|
/**
|
|
2
72
|
* 高德地图搜索模块
|
|
3
73
|
*
|
|
4
74
|
* 提供 POI 搜索、周边搜索、沿途搜索、多边形搜索和输入提示功能
|
|
5
75
|
*/
|
|
6
|
-
declare const ExpoGaodeMapSearchModule:
|
|
76
|
+
declare const ExpoGaodeMapSearchModule: ExpoGaodeMapSearchModuleType;
|
|
7
77
|
export default ExpoGaodeMapSearchModule;
|
package/build/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Coordinates, POI, POISearchOptions, NearbySearchOptions, AlongSearchOptions, PolygonSearchOptions, InputTipsOptions, InputTip, SearchResult, InputTipsResult } from './ExpoGaodeMapSearch.types';
|
|
1
|
+
import type { Coordinates, POI, POISearchOptions, NearbySearchOptions, AlongSearchOptions, PolygonSearchOptions, InputTipsOptions, InputTip, SearchResult, InputTipsResult, ReGeocodeOptions, ReGeocodeResult, AddressComponent, Road, RoadCross, AOI } from './ExpoGaodeMapSearch.types';
|
|
2
2
|
/**
|
|
3
3
|
* 初始化搜索模块(可选)
|
|
4
4
|
*
|
|
@@ -111,7 +111,36 @@ export declare function searchPolygon(options: PolygonSearchOptions): Promise<Se
|
|
|
111
111
|
* ```
|
|
112
112
|
*/
|
|
113
113
|
export declare function getInputTips(options: InputTipsOptions): Promise<InputTipsResult>;
|
|
114
|
-
|
|
114
|
+
/**
|
|
115
|
+
* 逆地理编码(坐标转地址)
|
|
116
|
+
*
|
|
117
|
+
* @param options 逆地理编码选项
|
|
118
|
+
* @returns 逆地理编码结果
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```typescript
|
|
122
|
+
* const result = await reGeocode({
|
|
123
|
+
* location: { latitude: 39.9, longitude: 116.4 },
|
|
124
|
+
* radius: 1000,
|
|
125
|
+
* });
|
|
126
|
+
* console.log(result.formattedAddress);
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
export declare function reGeocode(options: ReGeocodeOptions): Promise<ReGeocodeResult>;
|
|
130
|
+
/**
|
|
131
|
+
* POI 详情查询
|
|
132
|
+
*
|
|
133
|
+
* @param id POI ID
|
|
134
|
+
* @returns POI 详情
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```typescript
|
|
138
|
+
* const poi = await getPoiDetail('B000A83M61');
|
|
139
|
+
* console.log(poi.name, poi.address);
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
export declare function getPoiDetail(id: string): Promise<POI>;
|
|
143
|
+
export type { Coordinates, POI, POISearchOptions, NearbySearchOptions, AlongSearchOptions, PolygonSearchOptions, InputTipsOptions, InputTip, SearchResult, InputTipsResult, ReGeocodeOptions, ReGeocodeResult, AddressComponent, Road, RoadCross, AOI, };
|
|
115
144
|
export { SearchType } from './ExpoGaodeMapSearch.types';
|
|
116
145
|
declare const _default: {
|
|
117
146
|
initSearch: typeof initSearch;
|
|
@@ -120,5 +149,6 @@ declare const _default: {
|
|
|
120
149
|
searchAlong: typeof searchAlong;
|
|
121
150
|
searchPolygon: typeof searchPolygon;
|
|
122
151
|
getInputTips: typeof getInputTips;
|
|
152
|
+
reGeocode: typeof reGeocode;
|
|
123
153
|
};
|
|
124
154
|
export default _default;
|
package/build/index.js
CHANGED
|
@@ -10,6 +10,8 @@ exports.searchNearby = searchNearby;
|
|
|
10
10
|
exports.searchAlong = searchAlong;
|
|
11
11
|
exports.searchPolygon = searchPolygon;
|
|
12
12
|
exports.getInputTips = getInputTips;
|
|
13
|
+
exports.reGeocode = reGeocode;
|
|
14
|
+
exports.getPoiDetail = getPoiDetail;
|
|
13
15
|
const ExpoGaodeMapSearchModule_1 = __importDefault(require("./ExpoGaodeMapSearchModule"));
|
|
14
16
|
/**
|
|
15
17
|
* 初始化搜索模块(可选)
|
|
@@ -135,6 +137,39 @@ async function searchPolygon(options) {
|
|
|
135
137
|
async function getInputTips(options) {
|
|
136
138
|
return await ExpoGaodeMapSearchModule_1.default.getInputTips(options);
|
|
137
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* 逆地理编码(坐标转地址)
|
|
142
|
+
*
|
|
143
|
+
* @param options 逆地理编码选项
|
|
144
|
+
* @returns 逆地理编码结果
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```typescript
|
|
148
|
+
* const result = await reGeocode({
|
|
149
|
+
* location: { latitude: 39.9, longitude: 116.4 },
|
|
150
|
+
* radius: 1000,
|
|
151
|
+
* });
|
|
152
|
+
* console.log(result.formattedAddress);
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
async function reGeocode(options) {
|
|
156
|
+
return await ExpoGaodeMapSearchModule_1.default.reGeocode(options);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* POI 详情查询
|
|
160
|
+
*
|
|
161
|
+
* @param id POI ID
|
|
162
|
+
* @returns POI 详情
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* ```typescript
|
|
166
|
+
* const poi = await getPoiDetail('B000A83M61');
|
|
167
|
+
* console.log(poi.name, poi.address);
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
async function getPoiDetail(id) {
|
|
171
|
+
return await ExpoGaodeMapSearchModule_1.default.getPoiDetail(id);
|
|
172
|
+
}
|
|
138
173
|
var ExpoGaodeMapSearch_types_1 = require("./ExpoGaodeMapSearch.types");
|
|
139
174
|
Object.defineProperty(exports, "SearchType", { enumerable: true, get: function () { return ExpoGaodeMapSearch_types_1.SearchType; } });
|
|
140
175
|
// 默认导出
|
|
@@ -145,4 +180,5 @@ exports.default = {
|
|
|
145
180
|
searchAlong,
|
|
146
181
|
searchPolygon,
|
|
147
182
|
getInputTips,
|
|
183
|
+
reGeocode,
|
|
148
184
|
};
|