基于 geocoding 的 OpenHarmony 适配版,提供地理编码与反向地理编码(地址与经纬度互转)
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 2 年前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 1 年前 | ||
| 6 年前 | ||
| 1 年前 | ||
| 2 个月前 | ||
| 6 年前 | ||
| 3 年前 | ||
| 6 年前 | ||
| 1 年前 | ||
| 2 个月前 | ||
| 1 个月前 | ||
| 4 年前 | ||
| 2 个月前 |
模板版本: v0.0.1
geocoding
本项目基于 geocoding 开发。
1. 安装与使用
1.1 安装方式
进入到工程目录并在 pubspec.yaml 中添加以下依赖:
pubspec.yaml
...
dependencies:
geocoding_ohos:
git:
url: https://gitcode.com/CPF-Flutter/fluttertpc_geocoding.git
# ref: 根据下方表格选择不同框架适配的TAG版本
ref: 3.0.0_ohos_1.0.0
...
执行命令
flutter pub get
TAG 命名规则:原库版本-ohos-版本号-betax,不同 TAG 之间的变更详见 CHANGELOG.OpenHarmony.md。实际使用时请将依赖示例中的 TAG 替换为下表选择的 TAG。
| Flutter 框架版本 | TAG 名称 | 分支名 |
|---|---|---|
| 3.7 | 3.0.0_ohos_1.0.0 | master |
| 3.22 | 3.0.0_ohos_1.0.0 | master |
| 3.27 | 4.0.0-ohos.1.0.0-beta.1 | br_v4.0.0_ohos |
| 3.35 | 4.0.0-ohos.1.0.0-beta.1 | br_v4.0.0_ohos |
1.2 使用案例
使用案例详见 geocoding_ohos/example
2. 约束与限制
2.1 兼容性
在以下版本中已测试通过
- Flutter: 3.7.12-ohos-1.0.6; SDK: 5.0.0(12); IDE: DevEco Studio: 5.0.13.200; ROM: 5.1.0.120 SP3;
- Flutter: 3.22.1-ohos-1.0.1; SDK: 5.0.0(12); IDE: DevEco Studio: 5.0.13.200; ROM: 5.1.0.120 SP3;
3. API
"ohos Support"列为 yes 表示 ohos 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。
| Name | Description | Type | Input | Output | ohos Support |
|---|---|---|---|---|---|
| setLocaleIdentifier | 设置语言环境 | function | String localeIdentifier | Future | yes |
| locationFromAddress | 将文本地址转换为纬度和经度坐标 | function | String address | Future<List> | yes |
| placemarkFromAddress | 将文本地址转换为详细的地址标记信息 | function | String address | Future<List> | yes |
| placemarkFromCoordinates | 将经纬度坐标转换为详细的地址标记信息 | function | double latitude,double longitude | Future<List> | yes |
| isPresent | 判断地理编码与逆地理编码服务状态 | function | / | Future | yes |
4. 属性
"ohos Support"列为 yes 表示 ohos 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。
Parameters
| Name | Description | Type | ohos Support |
|---|---|---|---|
| localeIdentifier | 地址信息:[languageCode]_[countryCode](例如 en_US 或 nl_NL) | String | yes |
| address | 文本地址(如"北京市海淀区中关村大街1号") | String | yes |
| latitude | 纬度坐标 | double | yes |
| longitude | 精度坐标 | double | yes |
5. 遗留问题
6. 其他
7. 开源协议
本项目基于 MIT License ,请自由地享受和参与开源。