android - Places Autocomplete API to get GPS coordinates from address entered -
i have address field in app user needs come in required address. have used google geocoder gps coordinates of address . want create easier user using places autocomplete . places autocomplete returns address , id , reference of place .
is there way gps coordinates of address selected user using places autocomplete api ? have utilize geocoder 1 time again after user selects address places autocomplete ?
or should utilize places api 1 time again after user selects address gps coordinates of address ? dont want send multiple requests places api because of usage limits in place . . expected response places api ..there no gps coordinates in response .
"status": "ok", "predictions": [ { "description": "paris, france", "id" : "691b237b0322f28988f3ce03e321ff72a12167fd", "reference": "ciqyaaaa0q_ja...kt3ufvlddvtqsowz_tc", "terms": [ { "value": "paris", "offset": 0 }, { "value": "france", "offset": 7 } ], "types": [ "geocode" ], "matched_substrings": [ { "offset": 0, "length": 5 } ] }, { "description": "paris, tx, united states", "id" : "518e47f3d7f39277eb3bc895cb84419c2b43b5ac", "reference": "cjqjaaaahnbxzz...bdr3iiofdmtxwo1jhg", "terms": [ { "value": "paris", "offset": 0 }, { "value": "tx", "offset": 7 }, { "value": "united states", "offset": 11 } ], "types": [ "geocode" ], "matched_substrings": [ { "offset": 0, "length": 5 } ] }, { "description": "paris, ontario, canada", "id" : "e7ac9c89d4a590305242b0cb5bf43064027223c9", "reference": "cjqhaaaaiv_ywyt...f8kzhy36twmrbyu_g", "terms": [ { "value": "paris", "offset": 0 }, { "value": "ontario", "offset": 7 }, { "value": "canada", "offset": 16 } ], "types": [ "geocode" ], "matched_substrings": [ { "offset": 0, "length": 5 } ] }
you utilize place details part of places api actual place reference in each suggestion using "reference" value. example:
https://maps.googleapis.com/maps/api/place/details/json?reference=ciqyaaaa0q_ja...kt3ufvlddvtqsowz_tc&sensor=true&key=addyourownkeyhere
this give info place including coordinates (point specific location, bounds area).
android google-places-api google-geocoder google-geocoding-api
No comments:
Post a Comment