Skip to content

Commit

Permalink
fix(native-geocoder): update NativeGeocoderReverse result (#1840)
Browse files Browse the repository at this point in the history
* feat(nativegeocoder): add NativeGeocoder plugin

* add district

* update NativeGeocoderReverseResult & refactor code

* delete plugins

* delete index.ts
  • Loading branch information
sebastianbaar authored and ihadeed committed Aug 23, 2017
1 parent fe02c84 commit 7c1b409
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions src/@ionic-native/plugins/native-geocoder/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
* ...
*
* this.nativeGeocoder.reverseGeocode(52.5072095, 13.1452818)
* .then((result: NativeGeocoderReverseResult) => console.log('The address is ' + result.street + ' in ' + result.countryCode))
* .then((result: NativeGeocoderReverseResult) => console.log(JSON.stringify(result)))
* .catch((error: any) => console.log(error));
*
* this.nativeGeocoder.forwardGeocode('Berlin')
Expand All @@ -40,7 +40,7 @@ export class NativeGeocoder extends IonicNativePlugin {
* Reverse geocode a given latitude and longitude to find location address
* @param latitude {number} The latitude
* @param longitude {number} The longitude
* @return {Promise<any>}
* @return {Promise<NativeGeocoderReverseResult>}
*/
@Cordova({
callbackOrder: 'reverse'
Expand All @@ -50,48 +50,59 @@ export class NativeGeocoder extends IonicNativePlugin {
/**
* Forward geocode a given address to find coordinates
* @param addressString {string} The address to be geocoded
* @return {Promise<any>}
* @return {Promise<NativeGeocoderForwardResult>}
*/
@Cordova({
callbackOrder: 'reverse'
})
forwardGeocode(addressString: string): Promise<NativeGeocoderForwardResult> { return; }

}

/**
* Encapsulates format information about a reverse geocoding result.
* more Info:
* - https://developer.apple.com/documentation/corelocation/clplacemark
* - https://developer.android.com/reference/android/location/Address.html
*/
export interface NativeGeocoderReverseResult {
/**
* The street.
* The country code.
*/
street: string;
countryCode: string;
/**
* The house number.
* The country name.
*/
houseNumber: string;
countryName: string;
/**
* The postal code.
*/
postalCode: string;
/**
* The city.
* The administrativeArea.
*/
city: string;
administrativeArea: string;
/**
* The district.
* The subAdministrativeArea.
*/
district: string;
subAdministrativeArea: string;
/**
* The country name.
* The locality.
*/
countryName: string;
locality: string;
/**
* The country code.
* The subLocality.
*/
countryCode: string;
subLocality: string;
/**
* The thoroughfare.
*/
thoroughfare: string;
/**
* The subThoroughfare.
*/
subThoroughfare: string;
}

/**
* Encapsulates format information about a forward geocoding result.
*/
Expand Down

4 comments on commit 7c1b409

@quedicesebas
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happen here? why street disappears? Nothing matchs with the docs here https://ionicframework.com/docs/native/native-geocoder/

@ihadeed
Copy link
Collaborator

@ihadeed ihadeed commented on 7c1b409 Aug 27, 2017 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@quedicesebas
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NativeGeocoderReverseResult properties did no match with results obained. Bu are already updated

@quedicesebas
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know why resverse geocode didn't shows address like before?

Please sign in to comment.