Panduan Memulai
Salin prompt setup yang berisi langkah install dan panduan markdown lengkap untuk plugin ini.
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.
Anda bisa menggunakan AI-Assisted Setup kami untuk menginstal plugin ini. Tambahkan skill Capgo ke tool AI Anda dengan command berikut:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsLalu gunakan prompt berikut:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-nativegeocoder` plugin in my project.Jika Anda lebih memilih Manual Setup, instal plugin dengan menjalankan perintah berikut dan ikuti petunjuk khusus platform di bawah ini:
npm install @capgo/capacitor-nativegeocodernpx cap syncimport { NativeGeocoder } from '@capgo/capacitor-nativegeocoder';Mulai cepat
Bagian berjudul “Mulai cepat”import { NativeGeocoder } from '@capgo/capacitor-nativegeocoder';
const { addresses } = await NativeGeocoder.reverseGeocode({ latitude: 48.8566, longitude: 2.3522, maxResults: 1,});Contoh: forward geocode sebuah alamat
Bagian berjudul “Contoh: forward geocode sebuah alamat”const { addresses } = await NativeGeocoder.forwardGeocode({ address: '1 Infinite Loop, Cupertino, CA', maxResults: 3,});Kesalahan umum
Bagian berjudul “Kesalahan umum”- Kunci web API: reverse dan forward geocoding di web memerlukan kunci API Google Geocoding di bagian options.
- Locale: atur
useLocaleataudefaultLocalesaat menampilkan alamat secara internasional. - Alamat tidak jelas: munculkan
maxResultsand let users pick among matches.
Ringkasan API
Bagian berjudul “Ikhtisar API”reverseGeocode
Bagian berjudul “reverseGeocode”Konversi latitude dan longitude ke alamat
import { NativeGeocoder } from '@capgo/capacitor-nativegeocoder';
const result = await NativeGeocoder.reverseGeocode({ latitude: 48.8566, longitude: 2.3522,});console.log(result);forwardGeocode
Bagian berjudul “forwardGeocode”Konversi alamat ke latitude dan longitude
import { NativeGeocoder } from '@capgo/capacitor-nativegeocoder';
const result = await NativeGeocoder.forwardGeocode({ addressString: 'address-string' });console.log(result);Referensi Tipe
Bagian berjudul “Referensi Tipe”ReverseOptions
Bagian berjudul “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
Bagian berjudul “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
Bagian berjudul “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;}Sumber Kebenaran
Bagian berjudul “Sumber Kebenaran”Halaman ini dibuat dari plugin src/definitions.ts. Jalankan ulang sync saat API publik berubah di upstream.
Lanjutkan dari Getting Started
Bagian berjudul “Lanjutkan dari Getting Started”Jika Anda menggunakan Panduan Memulai untuk merencanakan operasi dashboard dan API, hubungkan dengan Menggunakan @capgo/capacitor-nativegeocoder untuk kapabilitas native di Menggunakan @capgo/capacitor-nativegeocoder, Ringkasan API untuk detail implementasi di API Overview, Pendahuluan untuk detail implementasi di Introduction, Kunci API untuk detail implementasi di API Keys, dan Perangkat untuk detail implementasi di Devices.