跳过主要内容
返回插件
@capgo/capacitor-nativegeocoder 重命名 capgo从@nativegeocoder重命名为@capgo/capacitor-nativegeocoder以使包名与Capacitor插件仓库匹配。
教程
由github.com/Cap-go

原生地理编码

使用原生地理编码将地址转换为坐标和坐标转换为地址

指南

原生地理编码教程

使用 @capgo/capacitor-nativegeocoder

Capacitor 原生前向和反向地理编码插件

安装

npm install @capgo/capacitor-nativegeocoder
npx cap sync

此插件暴露的内容

  • reverseGeocode - 将经纬度转换为地址。
  • forwardGeocode - 将地址转换为经纬度。

示例用法

reverseGeocode

将经纬度转换为地址。

import { NativeGeocoder } from '@capgo/capacitor-nativegeocoder';

await NativeGeocoder.reverseGeocode({} as ReverseOptions);

forwardGeocode

将地址转换为经纬度。

import { NativeGeocoder } from '@capgo/capacitor-nativegeocoder';

await NativeGeocoder.forwardGeocode({} as ForwardOptions);

全局参考