MobileChromeApps / google-play-services

A Cordova plugin for Android that adds Google Play Services
51 stars 94 forks source link

Possible bug with geocoding #10

Closed hirbod closed 10 years ago

hirbod commented 10 years ago

Hey everybody,

could someone please check this issue (the google maps plugin depens on your google-play-services plugin)

https://github.com/wf9a5m75/phonegap-googlemaps-plugin/issues/229

Seems like there is a bug.

Thanks!

mmocny commented 10 years ago

Looks like you found the bug, and it was in that plugin afterall. Good job!

Closing this, since their is no action item here.

hirbod commented 10 years ago

No, it was another bug I've found. This bug is still present. Please read only the first issue.

hirbod commented 10 years ago

To be more clear. The maps-plugin depens on your play service plugin. We've checked the code and on JS or PHP SDK everything is fine. But when tying to geocode trough your plugin, there is a small bug.

I make a Geocoding-Request like this:

var request = {
   'address': "Fritzlarer Str. 40 Frankfurt"
};

plugin.google.maps.Geocoder.geocode(request, function(results, errorMsg) {

And I receive this: (which is perfect)

country:"DE"
extra:Object
featureName:"40"
locale:"de_DE
"locality:"Frankfurt"
position: Object
   lat:50.1250006
   lng:8.6357671
postalCode:"60487"
subThoroughfare:"40"
thoroughfare:"Fritzlarer Straße"

But then for later stuff, I save the position object

$scope.lastPos = result.position;

And later, I call like this reverse

var request = {
    'position': $scope.lastPos
};

plugin.google.maps.Geocoder.geocode(request, function(results) 
{

This time I pass coordinates instead of the address, and I'm getting different results.

country: "DE"
extra: Object
   featureName: ""
locale: "de_DE"
locality: "Frankfurt am Main"
position: Object
   lat: 50.1250006
   lng: 8.6357671
postalCode: "60487"
subThoroughfare: ""
thoroughfare:"Fritzlarer Straße"

As you can see, subThoroughfare / featureName is empty. This is like 80% of my request. The housenumber is suddently missing (not everytime, but in most cases)

What is wrong? As you can see, I pass and get the excat lat and lng and everything is fine but the subThoroughfare is empty.

As you can see here, they just calling your plugin to get the data: https://github.com/wf9a5m75/phonegap-googlemaps-plugin/blob/test/src/android/plugin/google/maps/MyGeocoder.java#L125

So this must be a bug with play services..