Closed hansemannn closed 7 years ago
@hansemannn, thanks for your PR! By analyzing the history of the files in this pull request, we identified @yozef and @bitfabrikken to be potential reviewers.
Absolutely :)
Currently using Ti's Ti.Geolocation.reverseGeocoder
now :)
Will update here..
I guess Google's API is restricted by the API key you use. But the results are pretty advanced, so people might prefer it.
I'm using this code:
var Map = require('ti.googlemaps'); // iOS Google Maps
Map.setAPIKey("AIzzzzzxxxxxxxxx");
// on map panning, I get _longitude, _latitude
Map.reverseGeocoder({
latitude: _latitude,
longitude: _longitude
}, function(e) {
alert('Address found!');
$.addressTF.value = e.firstResult;
Ti.API.info(e.firstResult);
Ti.API.info(e.results);
});
Script Error {
[ERROR] : column = 39;
[ERROR] : line = 1149;
[ERROR] : message = "undefined is not a function (evaluating 'Map.reverseGeocoder')";
I wonder if this is on my end... still debugging...
I see reverseGeocodeCoordinate
in the code :p
Works!
Though README should state:
maps.reverseGeocodeCoordinate({ // not reverseGeocoder
latitude: 36.368122,
longitude: -120.913653
}, function(e) {
alert('Address found!');
Ti.API.info(e.firstResult);
Ti.API.info(e.results);
});
Also the Object returned is very different than ti.map (for Android) nort sure if we should return the same object structure?
I can do that if you think it's better to have the same structure between ti.googlemaps (iOS) and ti.map (Android)
Good point! I updated the api to reverseGeocoder
with 3 params (lat, lon, callback), renamed the callback properties to places
and firstPlace
(specific for this module, makes it easier to access the best match. I also moved the lat and lon from the coordinate
dict directly to the root of the result dict. Oh, and I added the code
and success
keys for consistency. Check it out!
Looks good!
@yozef for your review! 😊