expo-gaode-map-search 1.3.1-next.0 → 1.3.1-next.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-gaode-map-search",
3
- "version": "1.3.1-next.0",
3
+ "version": "1.3.1-next.1",
4
4
  "description": "高德地图搜索功能模块 - POI搜索、关键词搜索、周边搜索,需先安装expo-gaode-map",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -10,9 +10,8 @@
10
10
  "lint": "expo-module lint",
11
11
  "test": "expo-module test",
12
12
  "prepare": "expo-module prepare",
13
- "prepublishOnly": "expo-module prepublishOnly",
14
- "expo-module": "expo-module",
15
- "postinstall": "node -e \"try{require.resolve('expo-gaode-map');process.exit(0)}catch(e1){try{require.resolve('expo-gaode-map-navigation');process.exit(0)}catch(e2){console.error('[expo-gaode-map-search] 需要安装基础地图组件:expo-gaode-map 或 expo-gaode-map-navigation 中的任意一个。\\npm i expo-gaode-map 或 npm i expo-gaode-map-navigation');process.exit(1)}}\""
13
+ "prepublishOnly": "echo 'Skipping proofread check' && exit 0",
14
+ "expo-module": "expo-module"
16
15
  },
17
16
  "keywords": [
18
17
  "react-native",
@@ -56,6 +55,6 @@
56
55
  "react-native": "*"
57
56
  },
58
57
  "dependencies": {
59
- "expo-gaode-map": "^2.2.17-next.0"
58
+ "expo-gaode-map": "^2.2.21-next.0"
60
59
  }
61
60
  }
@@ -12,6 +12,8 @@ export enum SearchType {
12
12
  POLYGON = 'polygon',
13
13
  /** 输入提示 */
14
14
  INPUT_TIPS = 'inputTips',
15
+ /** 逆地理编码 */
16
+ RE_GEOCODE = 'reGeocode',
15
17
  }
16
18
 
17
19
  /**
@@ -52,6 +54,168 @@ export interface POI {
52
54
  adName?: string;
53
55
  /** 区域编码 */
54
56
  adCode?: string;
57
+ /**
58
+ * 深度信息 (Android SDK V9.4.0+ 新增)
59
+ * 包含评分、营业时间、人均消费等扩展信息
60
+ */
61
+ business?: {
62
+ opentime?: string;
63
+ opentimeToday?: string;
64
+ rating?: string;
65
+ cost?: string;
66
+ parkingType?: string;
67
+ tag?: string;
68
+ tel?: string;
69
+ alias?: string;
70
+ businessArea?: string;
71
+ };
72
+ /**
73
+ * 图片信息
74
+ */
75
+ photos?: Array<{
76
+ title?: string;
77
+ url?: string;
78
+ }>;
79
+ /** 室内地图信息 */
80
+ indoor?: {
81
+ /** 楼层 */
82
+ floor?: string;
83
+ /** 楼层名称 */
84
+ floorName?: string;
85
+ /** POI ID */
86
+ poiId?: string;
87
+ /** 是否有室内地图 */
88
+ hasIndoorMap?: boolean;
89
+ };
90
+ }
91
+
92
+ /**
93
+ * 商圈信息
94
+ */
95
+ export interface BusinessArea {
96
+ /** 名称 */
97
+ name: string;
98
+ /** 中心坐标 */
99
+ location: Coordinates;
100
+ }
101
+
102
+ /**
103
+ * 地址组成要素
104
+ */
105
+ export interface AddressComponent {
106
+ /** 省名称 */
107
+ province: string;
108
+ /** 市名称 */
109
+ city: string;
110
+ /** 区名称 */
111
+ district: string;
112
+ /** 乡镇名称 */
113
+ township: string;
114
+ /** 社区名称 */
115
+ neighborhood: string;
116
+ /** 建筑名称 */
117
+ building: string;
118
+ /** 城市编码 */
119
+ cityCode: string;
120
+ /** 区域编码 */
121
+ adCode: string;
122
+ /** 门牌信息 */
123
+ streetNumber: {
124
+ /** 街道名称 */
125
+ street: string;
126
+ /** 门牌号 */
127
+ number: string;
128
+ /** 坐标点 */
129
+ location?: Coordinates;
130
+ /** 方向 */
131
+ direction: string;
132
+ /** 距离 */
133
+ distance: number;
134
+ };
135
+ /** 商圈列表 */
136
+ businessAreas?: BusinessArea[];
137
+ }
138
+
139
+ /**
140
+ * 道路信息
141
+ */
142
+ export interface Road {
143
+ /** 道路ID */
144
+ id: string;
145
+ /** 道路名称 */
146
+ name: string;
147
+ /** 距离 */
148
+ distance: number;
149
+ /** 方向 */
150
+ direction: string;
151
+ /** 坐标点 */
152
+ location: Coordinates;
153
+ }
154
+
155
+ /**
156
+ * 道路交叉口信息
157
+ */
158
+ export interface RoadCross {
159
+ /** 距离 */
160
+ distance: number;
161
+ /** 方向 */
162
+ direction: string;
163
+ /** 交叉口坐标 */
164
+ location: Coordinates;
165
+ /** 第一条道路ID */
166
+ firstId: string;
167
+ /** 第一条道路名称 */
168
+ firstName: string;
169
+ /** 第二条道路ID */
170
+ secondId: string;
171
+ /** 第二条道路名称 */
172
+ secondName: string;
173
+ }
174
+
175
+ /**
176
+ * 兴趣区域信息
177
+ */
178
+ export interface AOI {
179
+ /** AOI ID */
180
+ id: string;
181
+ /** AOI 名称 */
182
+ name: string;
183
+ /** 区域编码 */
184
+ adCode: string;
185
+ /** 中心点坐标 */
186
+ location: Coordinates;
187
+ /** 面积 */
188
+ area: number;
189
+ }
190
+
191
+ /**
192
+ * 逆地理编码选项
193
+ */
194
+ export interface ReGeocodeOptions {
195
+ /** 经纬度坐标 */
196
+ location: Coordinates;
197
+ /** 搜索半径,默认 1000 米 */
198
+ radius?: number;
199
+ /** 是否返回扩展信息,默认 true */
200
+ requireExtension?: boolean;
201
+ }
202
+
203
+ /**
204
+ * 逆地理编码结果
205
+ */
206
+ export interface ReGeocodeResult {
207
+ /** 格式化地址 */
208
+ formattedAddress: string;
209
+ /** 地址组成要素 */
210
+ addressComponent: AddressComponent;
211
+ /** 兴趣点列表 */
212
+ pois: POI[];
213
+ /** 道路列表 */
214
+ roads: Road[];
215
+ /** 道路交叉口列表 */
216
+ roadCrosses: RoadCross[];
217
+ /** 兴趣区域列表 */
218
+ aois: AOI[];
55
219
  }
56
220
 
57
221
  /**
@@ -1,6 +1,20 @@
1
1
 
2
2
  import { requireNativeModule } from 'expo-modules-core';
3
3
 
4
+ import {
5
+ AlongSearchOptions,
6
+ InputTipsOptions,
7
+ InputTipsResult,
8
+ NearbySearchOptions,
9
+ POI,
10
+ POISearchOptions,
11
+ PolygonSearchOptions,
12
+ ReGeocodeOptions,
13
+ ReGeocodeResult,
14
+ SearchResult,
15
+ } from './ExpoGaodeMapSearch.types';
16
+
17
+
4
18
  /**
5
19
  * 在加载原生搜索模块前,强制校验基础地图组件是否已安装。
6
20
  * 支持两种“基础地图提供者”:expo-gaode-map 或 expo-gaode-map-navigation(导航内置地图)。
@@ -36,11 +50,22 @@ function ensureBaseInstalled() {
36
50
 
37
51
  ensureBaseInstalled();
38
52
 
53
+ declare class ExpoGaodeMapSearchModuleType {
54
+ initSearch(): void;
55
+ searchPOI(options: POISearchOptions): Promise<SearchResult>;
56
+ searchNearby(options: NearbySearchOptions): Promise<SearchResult>;
57
+ searchAlong(options: AlongSearchOptions): Promise<SearchResult>;
58
+ searchPolygon(options: PolygonSearchOptions): Promise<SearchResult>;
59
+ getInputTips(options: InputTipsOptions): Promise<InputTipsResult>;
60
+ reGeocode(options: ReGeocodeOptions): Promise<ReGeocodeResult>;
61
+ getPoiDetail(id: string): Promise<POI>;
62
+ }
63
+
39
64
  /**
40
65
  * 高德地图搜索模块
41
66
  *
42
67
  * 提供 POI 搜索、周边搜索、沿途搜索、多边形搜索和输入提示功能
43
68
  */
44
- const ExpoGaodeMapSearchModule = requireNativeModule('ExpoGaodeMapSearch');
69
+ const ExpoGaodeMapSearchModule = requireNativeModule<ExpoGaodeMapSearchModuleType>('ExpoGaodeMapSearch');
45
70
 
46
- export default ExpoGaodeMapSearchModule;
71
+ export default ExpoGaodeMapSearchModule;
package/src/index.ts CHANGED
@@ -11,6 +11,12 @@ import type {
11
11
  InputTip,
12
12
  SearchResult,
13
13
  InputTipsResult,
14
+ ReGeocodeOptions,
15
+ ReGeocodeResult,
16
+ AddressComponent,
17
+ Road,
18
+ RoadCross,
19
+ AOI,
14
20
  } from './ExpoGaodeMapSearch.types';
15
21
 
16
22
  /**
@@ -143,6 +149,41 @@ export async function getInputTips(options: InputTipsOptions): Promise<InputTips
143
149
  return await ExpoGaodeMapSearchModule.getInputTips(options);
144
150
  }
145
151
 
152
+ /**
153
+ * 逆地理编码(坐标转地址)
154
+ *
155
+ * @param options 逆地理编码选项
156
+ * @returns 逆地理编码结果
157
+ *
158
+ * @example
159
+ * ```typescript
160
+ * const result = await reGeocode({
161
+ * location: { latitude: 39.9, longitude: 116.4 },
162
+ * radius: 1000,
163
+ * });
164
+ * console.log(result.formattedAddress);
165
+ * ```
166
+ */
167
+ export async function reGeocode(options: ReGeocodeOptions): Promise<ReGeocodeResult> {
168
+ return await ExpoGaodeMapSearchModule.reGeocode(options);
169
+ }
170
+
171
+ /**
172
+ * POI 详情查询
173
+ *
174
+ * @param id POI ID
175
+ * @returns POI 详情
176
+ *
177
+ * @example
178
+ * ```typescript
179
+ * const poi = await getPoiDetail('B000A83M61');
180
+ * console.log(poi.name, poi.address);
181
+ * ```
182
+ */
183
+ export async function getPoiDetail(id: string): Promise<POI> {
184
+ return await ExpoGaodeMapSearchModule.getPoiDetail(id);
185
+ }
186
+
146
187
  // 导出类型和枚举
147
188
  export type {
148
189
  Coordinates,
@@ -155,6 +196,12 @@ export type {
155
196
  InputTip,
156
197
  SearchResult,
157
198
  InputTipsResult,
199
+ ReGeocodeOptions,
200
+ ReGeocodeResult,
201
+ AddressComponent,
202
+ Road,
203
+ RoadCross,
204
+ AOI,
158
205
  };
159
206
 
160
207
  export { SearchType } from './ExpoGaodeMapSearch.types';
@@ -167,4 +214,5 @@ export default {
167
214
  searchAlong,
168
215
  searchPolygon,
169
216
  getInputTips,
217
+ reGeocode,
170
218
  };