expo-gaode-map 2.2.1 → 2.2.2
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 +147 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,35 +1,167 @@
|
|
|
1
1
|
# expo-gaode-map
|
|
2
2
|
|
|
3
|
-
一个功能完整的高德地图 React Native
|
|
3
|
+
一个功能完整的高德地图 React Native 组件库,**基于 Expo Modules 开发**,采用 Monorepo 架构,提供地图显示、定位、搜索、导航、Web API 等完整功能。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
> 💡 本组件使用 [Expo Modules API](https://docs.expo.dev/modules/overview/) 构建,提供了类型安全的原生模块接口和优秀的开发体验。
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- [Documentation for the main branch](https://docs.expo.dev/versions/unversioned/sdk/gaode-map/)
|
|
7
|
+
## 📖 完整文档
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
**👉 [在线文档网站](https://TomWq.github.io/expo-gaode-map/)** · **👉 [示例仓库](https://github.com/TomWq/expo-gaode-map-example)**
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
包含完整的 API 文档、使用指南和示例代码:
|
|
12
|
+
- [快速开始](https://TomWq.github.io/expo-gaode-map/guide/getting-started.html)
|
|
13
|
+
- [初始化指南](https://TomWq.github.io/expo-gaode-map/guide/initialization.html)
|
|
14
|
+
- [搜索功能](https://TomWq.github.io/expo-gaode-map/guide/search.html)
|
|
15
|
+
- [导航功能](https://TomWq.github.io/expo-gaode-map/guide/navigation.html)
|
|
16
|
+
- [Web API](https://TomWq.github.io/expo-gaode-map/guide/web-api.html)
|
|
17
|
+
- [API 参考](https://TomWq.github.io/expo-gaode-map/api/)
|
|
18
|
+
- [使用示例](https://TomWq.github.io/expo-gaode-map/examples/)
|
|
13
19
|
|
|
14
|
-
|
|
20
|
+
## ✨ 主要特性
|
|
15
21
|
|
|
16
|
-
|
|
22
|
+
### 核心功能(expo-gaode-map)
|
|
23
|
+
- ✅ 完整的地图功能(多种地图类型、手势控制、相机操作)
|
|
24
|
+
- ✅ 精准定位(连续定位、单次定位、坐标转换)
|
|
25
|
+
- ✅ 丰富的覆盖物(Circle、Marker、Polyline、Polygon、HeatMap、Cluster 等)
|
|
26
|
+
- ✅ 完整的 TypeScript 类型定义
|
|
27
|
+
- ✅ 跨平台支持(Android、iOS)
|
|
28
|
+
- ✅ 同时支持 React Native 新旧架构(Paper & Fabric)
|
|
17
29
|
|
|
18
|
-
###
|
|
30
|
+
### 可选模块
|
|
31
|
+
- 🔍 **搜索功能**(expo-gaode-map-search)- POI 搜索、周边搜索、关键字搜索、地理编码等
|
|
32
|
+
- 🧭 **导航功能**(expo-gaode-map-navigation)- 驾车、步行、骑行、货车路径规划,实时导航
|
|
33
|
+
- 🌐 **Web API**(expo-gaode-map-web-api)- 纯 JavaScript 实现的路径规划、地理编码、POI 搜索等
|
|
19
34
|
|
|
20
|
-
|
|
35
|
+
## 📦 安装
|
|
36
|
+
|
|
37
|
+
### 方案一:仅使用地图和定位(核心包)
|
|
38
|
+
|
|
39
|
+
```bash
|
|
21
40
|
npm install expo-gaode-map
|
|
41
|
+
|
|
42
|
+
# 可选模块
|
|
43
|
+
npm install expo-gaode-map-search # 搜索功能
|
|
44
|
+
npm install expo-gaode-map-web-api # Web API
|
|
22
45
|
```
|
|
23
46
|
|
|
24
|
-
###
|
|
47
|
+
### 方案二:使用导航功能(导航包,已包含地图功能)
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm install expo-gaode-map-navigation # 包含地图+导航
|
|
51
|
+
|
|
52
|
+
# 可选模块
|
|
53
|
+
npm install expo-gaode-map-web-api # Web API
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
> ⚠️ **重要**:`expo-gaode-map` 和 `expo-gaode-map-navigation` 由于 SDK 冲突不能同时安装,二选一使用。
|
|
57
|
+
|
|
58
|
+
### Config Plugin 配置(推荐)
|
|
59
|
+
|
|
60
|
+
在 `app.json` 中配置,自动设置原生 API Key 和权限:
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"expo": {
|
|
65
|
+
"plugins": [
|
|
66
|
+
[
|
|
67
|
+
"expo-gaode-map", // 或 "expo-gaode-map-navigation"
|
|
68
|
+
{
|
|
69
|
+
"androidKey": "your-android-key",
|
|
70
|
+
"iosKey": "your-ios-key"
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
配置后重新构建:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
npx expo prebuild --clean
|
|
82
|
+
npx expo run:android
|
|
83
|
+
npx expo run:ios
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## 🚀 快速开始
|
|
87
|
+
|
|
88
|
+
详细的初始化和使用指南请查看:
|
|
89
|
+
- 📖 [快速开始文档](https://TomWq.github.io/expo-gaode-map/guide/getting-started.html)
|
|
90
|
+
- 💻 [完整示例代码](https://github.com/TomWq/expo-gaode-map-example)
|
|
91
|
+
|
|
92
|
+
## 📚 功能模块对比
|
|
93
|
+
|
|
94
|
+
| 功能 | 核心包 | 搜索包 | 导航包 | Web API |
|
|
95
|
+
|-----|-------|-------|-------|---------|
|
|
96
|
+
| 地图显示 | ✅ | ❌ | ✅ | ❌ |
|
|
97
|
+
| 定位 | ✅ | ❌ | ✅ | ❌ |
|
|
98
|
+
| 覆盖物 | ✅ | ❌ | ✅ | ❌ |
|
|
99
|
+
| POI 搜索 | ❌ | ✅ | ❌ | ✅ |
|
|
100
|
+
| 地理编码 | ❌ | ✅ | ❌ | ✅ |
|
|
101
|
+
| 路径规划 | ❌ | ❌ | ✅ | ✅ |
|
|
102
|
+
| 实时导航 | ❌ | ❌ | ✅ | ❌ |
|
|
103
|
+
| 平台 | 原生 | 原生 | 原生 | Web/原生 |
|
|
104
|
+
|
|
105
|
+
## 🏗️ Monorepo 架构
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
expo-gaode-map/
|
|
109
|
+
├── packages/
|
|
110
|
+
│ ├── core/ # expo-gaode-map(核心包)
|
|
111
|
+
│ │ └── 地图显示、定位、覆盖物
|
|
112
|
+
│ ├── search/ # expo-gaode-map-search(搜索包)
|
|
113
|
+
│ │ └── POI 搜索、地理编码
|
|
114
|
+
│ ├── navigation/ # expo-gaode-map-navigation(导航包)
|
|
115
|
+
│ │ └── 地图+导航(替代 core)
|
|
116
|
+
│ └── web-api/ # expo-gaode-map-web-api(Web API)
|
|
117
|
+
│ └── 纯 JS 实现的路径规划等
|
|
118
|
+
└── 注意:core 和 navigation 不能同时安装
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## 💡 常见问题
|
|
122
|
+
|
|
123
|
+
### 1. 核心包和导航包如何选择?
|
|
124
|
+
|
|
125
|
+
- **只需要地图和定位** → 安装 `expo-gaode-map`
|
|
126
|
+
- **需要导航功能** → 安装 `expo-gaode-map-navigation`(已包含地图功能)
|
|
127
|
+
- **不能同时安装**:两个包由于原生 SDK 冲突,只能选择其一
|
|
128
|
+
|
|
129
|
+
### 2. 搜索功能和 Web API 有什么区别?
|
|
130
|
+
|
|
131
|
+
- **搜索包**(`expo-gaode-map-search`):原生实现,性能更好,需要配置原生环境
|
|
132
|
+
- **Web API**(`expo-gaode-map-web-api`):纯 JavaScript,无需原生配置,跨平台更好
|
|
133
|
+
|
|
134
|
+
### 3. 如何配置 API Key?
|
|
135
|
+
|
|
136
|
+
推荐使用 Config Plugin 自动配置,详见:[初始化指南](https://TomWq.github.io/expo-gaode-map/guide/initialization.html)
|
|
137
|
+
|
|
138
|
+
## 🤝 贡献
|
|
139
|
+
|
|
140
|
+
欢迎提交 Issue 和 Pull Request!
|
|
141
|
+
|
|
142
|
+
## 📄 许可证
|
|
143
|
+
|
|
144
|
+
MIT
|
|
145
|
+
|
|
146
|
+
## 🔗 相关链接
|
|
147
|
+
|
|
148
|
+
- [在线文档](https://TomWq.github.io/expo-gaode-map/)
|
|
149
|
+
- [GitHub 仓库](https://github.com/TomWq/expo-gaode-map)
|
|
150
|
+
- [高德地图开放平台](https://lbs.amap.com/)
|
|
151
|
+
- [Expo Modules API](https://docs.expo.dev/modules/overview/)
|
|
25
152
|
|
|
153
|
+
## 🙏 致谢
|
|
26
154
|
|
|
155
|
+
本项目在开发过程中参考了以下优秀项目:
|
|
27
156
|
|
|
157
|
+
- **[react-native-amap3d](https://github.com/qiuxiang/react-native-amap3d)** - 一个优秀的 React Native 高德地图组件
|
|
28
158
|
|
|
29
|
-
|
|
159
|
+
感谢这些开源项目的贡献者们!
|
|
30
160
|
|
|
31
|
-
|
|
161
|
+
## 📮 反馈与支持
|
|
32
162
|
|
|
33
|
-
|
|
163
|
+
如果你在使用过程中遇到问题或有任何建议,欢迎:
|
|
34
164
|
|
|
35
|
-
|
|
165
|
+
- 📝 提交 [GitHub Issue](https://github.com/TomWq/expo-gaode-map/issues)
|
|
166
|
+
- 💬 参与 [Discussions](https://github.com/TomWq/expo-gaode-map/discussions)
|
|
167
|
+
- ⭐ 给项目点个 Star 支持一下
|