UNPKG

2.9 kBJavaScriptView Raw
1"use strict";
2var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 return c > 3 && r && Object.defineProperty(target, key, r), r;
7};
8var plugin_1 = require('./plugin');
9/**
10 * @beta
11 * @name NativeGeocoder
12 * @description
13 * Cordova plugin for native forward and reverse geocoding
14 *
15 * @usage
16 * ```typescript
17 * import { NativeGeocoder, NativeGeocoderReverseResult, NativeGeocoderForwardResult } from 'ionic-native';
18 *
19 * NativeGeocoder.reverseGeocode(52.5072095, 13.1452818)
20 * .then((result: NativeGeocoderReverseResult) => console.log("The address is " + result.address + " in " + result.countryCode))
21 * .catch((error: any) => console.log(error));
22 *
23 * NativeGeocoder.forwardGeocode("Berlin")
24 * .then((coordinates: NativeGeocoderForwardResult) => console.log("The coordinates are latitude=" + coordinates.latitude + " and longitude=" + coordinates.longitude))
25 * .catch((error: any) => console.log(error));
26 * ```
27 * @interfaces
28 * NativeGeocoderReverseResult
29 * NativeGeocoderForwardResult
30 */
31var NativeGeocoder = (function () {
32 function NativeGeocoder() {
33 }
34 /**
35 * Reverse geocode a given latitude and longitude to find location address
36 * @param latitude {number} The latitude
37 * @param longitude {number} The longitude
38 * @return {Promise<any>}
39 */
40 NativeGeocoder.reverseGeocode = function (latitude, longitude) { return; };
41 /**
42 * Forward geocode a given address to find coordinates
43 * @param addressString {string} The address to be geocoded
44 * @return {Promise<any>}
45 */
46 NativeGeocoder.forwardGeocode = function (addressString) { return; };
47 __decorate([
48 plugin_1.Cordova({
49 callbackOrder: 'reverse'
50 })
51 ], NativeGeocoder, "reverseGeocode", null);
52 __decorate([
53 plugin_1.Cordova({
54 callbackOrder: 'reverse'
55 })
56 ], NativeGeocoder, "forwardGeocode", null);
57 NativeGeocoder = __decorate([
58 plugin_1.Plugin({
59 pluginName: 'NativeGeocoder',
60 plugin: 'cordova-plugin-nativegeocoder',
61 pluginRef: 'nativegeocoder',
62 repo: 'https://github.com/sebastianbaar/cordova-plugin-nativegeocoder',
63 platforms: ['iOS', 'Android']
64 })
65 ], NativeGeocoder);
66 return NativeGeocoder;
67}());
68exports.NativeGeocoder = NativeGeocoder;
69//# sourceMappingURL=native-geocoder.js.map
\No newline at end of file