スタートガイド
インストール手順と、このプラグインの完全なMarkdownガイドを含むセットアッププロンプトをコピーします。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-nativegeocoder`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/nativegeocoder/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
インストール
「インストール」セクションAIアシストによるセットアップでプラグインをインストールできます。以下のコマンドを使用して、お使いのAIツールに Capgo のスキルを追加してください:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins次に、以下のプロンプトを使用します:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-nativegeocoder` plugin in my project.手動セットアップを希望する場合は、以下のコマンドを実行してプラグインをインストールし、下記のプラットフォーム別の手順に従ってください:
npm install @capgo/capacitor-nativegeocodernpx cap syncインポート
「インポート」セクションimport { NativeGeocoder } from '@capgo/capacitor-nativegeocoder';クイックスタート
「クイックスタート」セクションimport { NativeGeocoder } from '@capgo/capacitor-nativegeocoder';
const { addresses } = await NativeGeocoder.reverseGeocode({ latitude: 48.8566, longitude: 2.3522, maxResults: 1,});例:住所をフォワードジオコーディングする
「例:住所をフォワードジオコーディングする」というセクションconst { addresses } = await NativeGeocoder.forwardGeocode({ address: '1 Infinite Loop, Cupertino, CA', maxResults: 3,});よくある落とし穴
「よくある落とし穴」セクション- Web 用 API キー:Web でのリバースジオコーディングとフォワードジオコーディングには、options に Google Geocoding API キーが必要です。
- ロケール:設定
useLocaleまたはdefaultLocaleするのは、国際的な住所表示を行う場合です。 - 曖昧な住所: 発生
maxResultsユーザーに候補から選択させます。
API の概要
「API 概要」セクションreverseGeocode
「reverseGeocode」セクション緯度・経度を住所に変換
import { NativeGeocoder } from '@capgo/capacitor-nativegeocoder';
const result = await NativeGeocoder.reverseGeocode({ latitude: 48.8566, longitude: 2.3522,});console.log(result);forwardGeocode
「forwardGeocode」セクション住所を緯度・経度に変換
import { NativeGeocoder } from '@capgo/capacitor-nativegeocoder';
const result = await NativeGeocoder.forwardGeocode({ addressString: 'address-string' });console.log(result);型リファレンス
「型リファレンス」セクションReverseOptions
「ReverseOptions」セクションexport interface ReverseOptions { /** * latitude is a number representing the latitude of the location. */ latitude: number; /** * longitude is a number representing the longitude of the location. */ longitude: number; /** * Localise the results to the given locale. */ useLocale?: boolean; /** * locale is a string in the format of language_country, for example en_US. */ defaultLocale?: string; /** * Max number of results to return. */ maxResults?: number; /** * Only used for web platform to use google api */ apiKey?: string; /** * Only used for web platform to use google api */ resultType?: string;}Address
「Address」セクションexport interface Address { latitude: number; longitude: number; countryCode: string; countryName: string; postalCode: string; administrativeArea: string; subAdministrativeArea: string; locality: string; subLocality: string; thoroughfare: string; subThoroughfare: string; areasOfInterest: string[];}ForwardOptions
「ForwardOptions」セクションexport interface ForwardOptions { /** * address is a string of the address to be geocoded. */ addressString: string; /** * Localise the results to the given locale. */ useLocale?: boolean; /** * locale is a string in the format of language_country, for example en_US. */ defaultLocale?: string; /** * Max number of results to return. */ maxResults?: number; /** * Only used for web platform to use google api */ apiKey?: string;}Source of Truth
「Source Of Truth」セクションこのページはプラグインの src/definitions.tsから生成されています。upstream で公開 API が変更されたら、再度 sync を実行してください。
Getting Startedの続きを進める
「Getting Started からの続き」セクション使用している場合 スタートガイド ダッシュボードと API の運用を計画するには、これを次と連携させます @capgo/capacitor-nativegeocoder の使用方法 「@capgo/capacitor-nativegeocoder の使用方法」のネイティブ機能では、 API の概要 「API の概要」の実装の詳細については、 はじめに 「はじめに」における実装の詳細については、 API キー および「API Keys」の実装の詳細については、 デバイス 実装の詳細については Devices を参照してください。