問題描述
是否有我可以 ping 通的服務或 API,并將 lat/long 作為參數傳遞,它會返回 lat/long 對所在的郵政編碼?這是僅限美國,所以我不必擔心國際代碼等.
Is there a service or API I can ping, and pass in the lat/long as parameters, where it returns the zip code that lat/long pair is within? This is US-only, so I don't have to worry about international codes, etc.
我覺得谷歌地圖的反向地理編碼對我來說太重了.如果可能的話,我更喜歡更輕的東西.這將在 javascript 中完成.
I feel like Google Maps' reverse-geocoding is too heavy for me. I'd prefer something lighter, if possible. This will be done in javascript.
推薦答案
叫做反向地理編碼(地址查找).要獲取 lat: 40.714224, lng: -73.961452 的地址,請使用參數 latlng=40.714224,-73.961452& 查詢
(示例) 并返回 JSON 對象或使用 http://maps.googleapis.com/maps/api/geocode/json
sensor=truehttp://maps.googleapis.com/maps/api/geocode/xml
返回 XML 響應 (示例).它來自 Google,而且是免費的.
It is called Reverse Geocoding (Address Lookup). To get address for lat: 40.714224, lng: -73.961452 query http://maps.googleapis.com/maps/api/geocode/json
with parameters latlng=40.714224,-73.961452&sensor=true
(example) and it returns JSON object or use http://maps.googleapis.com/maps/api/geocode/xml
to return XML response (example). It's from Google and it's free.
這篇關于根據 lat & 獲取郵政編碼長的?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!