有沒有辦法從當地或拉特或長期獲取當前用戶位置的郵政編碼。 如果是這樣怎麼樣?郵政編碼
Q
郵政編碼
5
A
回答
5
是的,你可以...所有你需要做的是提取
http://maps.google.com/maps/geo?ll=緯度,經度
http://maps.google.com/maps/geo?ll=10.345561,123.896932
或者嘗試嘗試這種solutions.I可以給你出個主意。
你可以擁有一個城市嗎?使用此json數據,如果您擁有此格式郵政編碼的數據庫(在maxmind.com)
CountryCode |城市|郵政編碼
PH | |宿霧6000
現在查詢數據庫,是相對於,根據Google的回報COUNTRYCODE。
UPDATE
地址解析API V2已經推掉9月9日,2013年
這裏的API服務的新URL
http://maps.googleapis.com/maps/api/geocode/json?latlng=your_latitude,your_longitude
http://maps.googleapis.com/maps/api/geocode/json?latlng=10.32,123.90&sensor=true
7
使用Android Geocoder API!
getFromLocation(double,double,int)就是您所需要的。
2
基於地理編碼器實現:
private String getZipCodeFromLocation(Location location) {
Address addr = getAddressFromLocation(location);
return addr.getPostalCode() == null ? "" : addr.getPostalCode();
}
private Address getAddressFromLocation(Location location) {
Geocoder geocoder = new Geocoder(this);
Address address = new Address(Locale.getDefault());
try {
List<Address> addr = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1);
if (addr.size() > 0) {
address = addr.get(0);
}
} catch (IOException e) {
e.printStackTrace();
}
return address;
}
您也可以從地址等信息,比如城市名稱。
相關問題
- 1. 郵政編碼
- 2. Tableau:如何顯示郵政編碼或郵政編碼條目
- 3. 查找附近的郵政編碼與基礎郵政編碼
- 4. 郵政編碼和郵政編碼違反第三範式嗎?
- 5. 檢查郵政編碼或郵政編碼是否真實
- 6. 美國郵政編碼位於2郵政編碼的中間?
- 7. 郵編最近的郵政編碼?
- 8. 郵政編碼驗證
- 9. MKPolygon中的郵政編碼
- 10. Regex.IsMatch爲郵政編碼
- 11. geoip郵政編碼查詢
- 12. 驗證郵政編碼?
- 13. Jquery郵政編碼clientvalidate
- 14. 需要的郵政編碼
- 15. 加拿大郵政'查找郵政編碼'屏幕刮碼
- 16. MySQL在每個郵政編碼中找到最貴的郵政編碼
- 17. 使用YQL獲取郵政編碼半徑中的郵政編碼
- 18. 顯示谷歌地圖上的郵政編碼/郵政編碼範圍
- 19. 我試圖讓郵政編碼顯示在郵政編碼邊界內
- 20. 郵政編碼/郵政編碼只屬於一個街道+城市
- 21. 從Google地圖獲取郵政編碼
- 22. 郵政編碼相反(* [iter(s)] * n)
- 23. Geocoded不返回郵政編碼
- 24. PHP中的郵政編碼定位器
- 25. MySQL排序英國郵政編碼
- 26. 免費郵政編碼數據庫?
- 27. 國際郵政編碼搜索
- 28. 郵政編碼/地址存儲庫
- 29. 用於郵政編碼驗證的Javascript
- 30. excel中的郵政編碼距離
thanx ...讓我試試 – Udaykiran 2011-05-02 10:10:21
從第一個......沒有郵編來檢索 – Udaykiran 2011-05-02 10:19:48
@Udaykiran你需要另一個有zipcode記錄的數據庫。這是database.http的例子:/ /ipinfodb.com/zipcode_database.php – kedomonzter 2011-05-02 10:25:44