All Projects → sebastianbaar → Cordova Plugin Nativegeocoder

sebastianbaar / Cordova Plugin Nativegeocoder

Licence: mit
Cordova plugin for native forward and reverse geocoding

Programming Languages

java
68154 projects - #9 most used programming language
swift
15916 projects

Projects that are alternatives of or similar to Cordova Plugin Nativegeocoder

Cordova Admob Pro
🔥 Cordova Plugin for Google AdMob, DFP, ADX. Easy monetization using mobile Ad, with single line of JavaScript. Compatible with Cordova CLI, Inoic, PhoneGap Build, etc.
Stars: ✭ 690 (+1089.66%)
Mutual labels:  cordova-plugin
Ziptastic Php
Official Ziptastic PHP Library
Stars: ✭ 9 (-84.48%)
Mutual labels:  geocoder
Cl.kunder.webview
This cordova plugin enables you to open a second webview
Stars: ✭ 36 (-37.93%)
Mutual labels:  cordova-plugin
Cordova Plugin Ble Central
Bluetooth Low Energy (BLE) Central plugin for Apache Cordova (aka PhoneGap)
Stars: ✭ 830 (+1331.03%)
Mutual labels:  cordova-plugin
Geocoder
🌎 GoLang package that provides an easy way to use the Google Geocoding API
Stars: ✭ 23 (-60.34%)
Mutual labels:  geocoder
Starioplugin
Star Micronics printer phonegap/cordova plugin
Stars: ✭ 20 (-65.52%)
Mutual labels:  cordova-plugin
Geocoder
Geocode addresses to coordinates
Stars: ✭ 566 (+875.86%)
Mutual labels:  geocoder
Blinkid Cordova
ID scanning for cross-platform apps built with Cordova and Phonegap.
Stars: ✭ 44 (-24.14%)
Mutual labels:  cordova-plugin
Google Login With Ionic Framework
Ionic example app of how to add Google Plus authentication into an Ionic Framework app. Add google login to your ionic app!
Stars: ✭ 24 (-58.62%)
Mutual labels:  cordova-plugin
Awesome Cordova Plugins
A curated list of awesome Cordova Apache Plugins https://cordova.apache.org/plugins/
Stars: ✭ 33 (-43.1%)
Mutual labels:  cordova-plugin
Cordova Plugin Linkedin
Cordova plugin for LinkedIn
Stars: ✭ 17 (-70.69%)
Mutual labels:  cordova-plugin
Cordova Plugin Disable Bitcode
Cordova plugin to disable bitcode in iOS build settings
Stars: ✭ 19 (-67.24%)
Mutual labels:  cordova-plugin
Pelias Android Sdk
Android sdk for pelias
Stars: ✭ 20 (-65.52%)
Mutual labels:  geocoder
Node Geocoder
nodejs geocoding library
Stars: ✭ 800 (+1279.31%)
Mutual labels:  geocoder
Ionic4
This repo contains example code for ionic4. Get Step by Step tutorial of this repo examples using https://ampersandacademy.com/tutorials/ionic-framework-4
Stars: ✭ 37 (-36.21%)
Mutual labels:  cordova-plugin
Places
🌐 Turn any <input> into an address autocomplete
Stars: ✭ 5,322 (+9075.86%)
Mutual labels:  geocoder
Geocode
Geocode - A simple location code mapping latitude,longitude to a single alphanumeric string, or three locality names
Stars: ✭ 12 (-79.31%)
Mutual labels:  geocoder
Cj Google Geocoder
Stars: ✭ 49 (-15.52%)
Mutual labels:  geocoder
Bluetoothserial
Cordova (PhoneGap) Plugin for Serial Communication over Bluetooth
Stars: ✭ 999 (+1622.41%)
Mutual labels:  cordova-plugin
Cordova Plugin Permissionscope
🔓 Cordova plugin to handle iOS permissions
Stars: ✭ 27 (-53.45%)
Mutual labels:  cordova-plugin

Cordova NativeGeocoder plugin

Call nativegeocoder.reverseGeocode() to transform a latitude and longitude into an address or nativegeocoder.forwardGeocode() to transform an address into a latitude and longitude using iOS CoreLocation service and Android Geocoder class.

No need for creating API keys or querying external APIs

Please read Known Issues before posting an issue! Thank you! 😍

Ionic

This plugin is also available for Ionic Native & Capacitor.

Installation

cordova plugin add cordova-plugin-nativegeocoder

For iOS Cordova iOS version >5.0.0 is required.

Configuration

You can also configure the following variable to customize the iOS location plist entry

  • LOCATION_WHEN_IN_USE_DESCRIPTION for NSLocationWhenInUseUsageDescription (defaults to "Use geocoder service")

Supported Platforms

  • iOS
  • Android

API

.reverseGeocode(successCallback, errorCallback, latitude, longitude, options);

Reverse geocode a given latitude and longitude to find location address.

Parameters

Parameter Type Default Description
success Function Success callback (with Array)
error Function Error callback.
latitude Number The latitude.
longitude Number The longtitude.
options Object Optional. Is called when the api encounters an error while initializing the context.

All available options attributes:

Attribute Type Default Comment
useLocale Boolean true Optional. Only works for Android and iOS 11.0+.
defaultLocale String Optional. E.g.: 'fa-IR' or 'de_DE'; works only for Android and iOS 11.0+.
maxResults Number 1 Optional. Min value: 1, max value: 5.

Array

Conforms to Apple's and Android's geocoder's result arrays.

Value Type
latitude String
longitude String
countryCode String
postalCode String
administrativeArea String
subAdministrativeArea String
locality String
subLocality String
thoroughfare String
subThoroughfare String
areasOfInterest Array<String>

Example

nativegeocoder.reverseGeocode(success, failure, 52.5072095, 13.1452818, { useLocale: true, maxResults: 1 });

function success(result) {
  var firstResult = result[0];
  console.log("First Result: " + JSON.stringify(firstResult));
}

function failure(err) {
  console.log(err);
}

.forwardGeocode(success, error, addressString, options)

Forward geocode a given address to find coordinates.

Parameters

Parameter Type Default Description
success Function Success callback (with Array)
error Function Error callback.
addressString String The address to be geocoded.
options Object Optional. Is called when the api encounters an error while initializing the context.

All available options attributes:

Attribute Type Default Comment
useLocale Boolean true Optional. Only works for Android and iOS 11.0+.
defaultLocale String Optional. E.g.: 'fa-IR' or 'de_DE'; works only for Android and iOS 11.0+.
maxResults Number 1 Optional. Min value: 1, max value: 5.

Array

Conforms to Apple's and Android's geocoder's result arrays.

Value Type
latitude String
longitude String
countryCode String
postalCode String
administrativeArea String
subAdministrativeArea String
locality String
subLocality String
thoroughfare String
subThoroughfare String
areasOfInterest Array<String>

Example

nativegeocoder.forwardGeocode(success, failure, "Berlin", { useLocale: true, maxResults: 1 });

function success(coordinates) {
  var firstResult = coordinates[0];
  console.log("The coordinates are latitude = " + firstResult.latitude + " and longitude = " + firstResult.longitude);
}

function failure(err) {
  console.log(err);
}

Known Issues

Android

Geocoder not working

Errors like Geocoder is not present on this device/emulator., Geocoder [...] Error or Geocoder Service not available.

Why?: The plugin checks for Geocoder.isPresent() (Android docs). One reason for Geocoder not working on a device could be that you are running your app on an emulator or on a device without Google Play Services. But Geocoder API "[...] requires a backend service that is not included in the core android framework".

Any workaround?: Yes. Query Google Maps Geocoding API as a backup if Geocoder is not present.

Can the plugin handle this?: No. I decided not to implement Google Maps Geocoding API as a backup because you have to add an API key and more. I want this plugin to remain as small and lightweight as possible.

iOS

...

Thank you ❤️

Yes you! Thank you very much for using cordova-plugin-nativegeocoder. If you have any feedback or run into issues using the plugin, please file an issue on this repository.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].