现在我知道使用Geocomplete我可以获得城市,州邮政编码和其他许多信息。如何获得城市内的所有邮政编码/邮政编码。就像我找到here一样。我是从geocomplete获得的,还是应该从像Maxmind这样的geoip数据库中查询它?
答案 0 :(得分:1)
我在这里工作boundary-io.com 我认为这是你需要它使用美国人口普查作为存储库:美国邮政编码边界API: https://www.mashape.com/vanitysoft/boundaries-io
以上API按邮政编码,城市和州显示US Boundaries(GeoJson)。 您应该以编程方式使用API来处理大量结果。
例如:
答案 1 :(得分:0)
概念名称反向地理编码: -
在这里,您还可以获得总地址以及邮政编码: -
places.getDetails( request_details, function(results_details, status){
// Check if the Service is OK
if (status == google.maps.places.PlacesServiceStatus.OK) {
places_postal = results_details.address_components
places_phone = results_details.formatted_phone_number
places_phone_int = results_details.international_phone_number
places_format_address = results_details.formatted_address
places_google_url = results_details.url
places_website = results_details.website
places_rating = results_details.rating
for (var i = 0; i < places_postal.length; i++ ) {
if (places_postal[i].types == "postal_code" && ){
console.log(places_postal[i].long_name)
}
}
}
});
并检索邮政编码
var address = results[0].address_components;
var zipcode = address[address.length - 1].long_name;
答案 2 :(得分:0)
有各种各样的来源。美国邮政局是这方面的权威。不幸的是你必须购买数据库。您可以通过在线互动表格,一次一个城市,从USPS获得城市拉链的免费列表!
http://mobile.usps.com/iphone/iphoneFindZip.aspx
还有其他免费服务。这些是基于2010年美国人口普查ZCTA。这些用于人口普查目的的大致邮政编码边界,但不是100%匹配。 Maxmind不再提供免费数据库。 Geonames确实如此。你必须阅读它的完整性和准确性。
http://download.geonames.org/export/zip/
我曾经在这些事情上工作过。
[ADDED]对于任何感兴趣的人,我制作了一个(免费)CSV文件,其中包含大约所有USPS邮政编码及其相应的城市和纬度/经度。正如许多人所理解的那样,USPS数据集受版权保护,美国人口普查的免费ZCTA数据是近似值。
我决定使用以下方法来反向构建几乎整个集合。我在美国所有学校(103K学校)获得了美国教育部NCES数据集,并认为99%的邮政编码至少会在学校上学。我使用地址信息为城市建立了一套独特的邮政编码。统计数据显示,有大约41.5K的独特邮政编码。我的清单有43K - 假设一些邮政编码由于在一个以上的城市而有多个条目。另请注意,lat / lng不是区域质心。它只是邮政编码中某些学校的lat / lng。享受我的免费数据集!
格式:州,城市,ZipCode,纬度,经度 http://www.opengeocode.org/download/cityzip.zip