开发者

Get latitude and longitude based on zip using Geocoder class in Android

开发者 https://www.devze.com 2023-04-02 12:21 出处:网络
guys. Method getFromLocationName(..) in Geocoder class return Addresses by \"a user-supplied description of a location\". And if I\'m calling it with \"London\" string or \"Statue of Liberty\" it retu

guys. Method getFromLocationName(..) in Geocoder class return Addresses by "a user-supplied description of a location". And if I'm calling it with "London" string or "Statue of Liberty" it returns addresses and I can animate the Map to found coordinates. But iI need to find latitude and longitude based on ZIP CODE. If I call method with "33040" string (zip of Key West region) - Geocoder returns some another addresses (of course!), because it can't associate this string with zip. I have made some trick: adding "usa " prefix if user 开发者_如何学JAVAenters decimal value. And it returns currect locations by string "usa 33040" and others in 70%. Is any idea how to find location by ZIP in 100% cases? Thanks!


Have you tried strings like "33040, United States"? That format certainly works in Google Maps, so it may work on Android, though the Android geocoder is not as good as that Google Maps uses.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号