Native Geocoderβ

Improve this doc

This plugin is still in beta stage and may not work as expected. Please submit any issues to the plugin repo.

$ ionic plugin add cordova-plugin-nativegeocoder
$ npm install --save @ionic-native/native-geocoder

Repo: https://github.com/sebastianbaar/cordova-plugin-nativegeocoder

Cordova plugin for native forward and reverse geocoding

Supported platforms

Usage

import { NativeGeocoder, NativeGeocoderReverseResult, NativeGeocoderForwardResult } from '@ionic-native/native-geocoder';

constructor(private nativeGeocoder: NativeGeocoder) { }

...

this.nativeGeocoder.reverseGeocode(52.5072095, 13.1452818)
  .then((result: NativeGeocoderReverseResult) => console.log("The address is " + result.street + " in " + result.countryCode))
  .catch((error: any) => console.log(error));

this.nativeGeocoder.forwardGeocode("Berlin")
  .then((coordinates: NativeGeocoderForwardResult) => console.log("The coordinates are latitude=" + coordinates.latitude + " and longitude=" + coordinates.longitude))
  .catch((error: any) => console.log(error));

Instance Members

reverseGeocode(latitude, longitude)

Reverse geocode a given latitude and longitude to find location address

Param Type Details
latitude number

The latitude

longitude number

The longitude

Returns: Promise<any>

forwardGeocode(addressString)

Forward geocode a given address to find coordinates

Param Type Details
addressString string

The address to be geocoded

Returns: Promise<any>

NativeGeocoderReverseResult

Param Type Details
street string

The street.

houseNumber string

The house number.

postalCode string

The postal code.

city string

The city.

district string

The district.

countryName string

The country name.

countryCode string

The country code.

NativeGeocoderForwardResult

Param Type Details
latitude string

The latitude.

longitude string

The longitude.

API

Native

General