The 2017 Ionic Developer Survey Results are in!

Native Geocoder

Improve this doc

Cordova plugin for native forward and reverse geocoding

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

Installation

  1. Install the Cordova and Ionic Native plugins:
    $ ionic cordova plugin add cordova-plugin-nativegeocoder
    $ npm install --save @ionic-native/native-geocoder
    
  2. Add this plugin to your app's module

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