从地址获取 zip +4 的最佳 api/资源是什么?
我不想要需要不时下载和更新的东西;我想要一个自动更新的。
目标是查找州和联邦官员而不会获得“重复”职位。
从地址获取 zip +4 的最佳 api/资源是什么?
我不想要需要不时下载和更新的东西;我想要一个自动更新的。
目标是查找州和联邦官员而不会获得“重复”职位。
更新:
回应你的评论
这很容易计数 1, 2, 3 ;)
看看这个:
你需要寻找谷歌地图地理编码服务!(视口偏置)
示例代码是:
使用 jQuery
$(function() {
$.getJSON("http://maps.google.com/maps/api/geocode/json?address=Winnetka&sensor=false",
function(data) {
var zip_code = data.results[0].long_name;
alert(zip_code);
});
});
雅虎在他们的 API 中有一个 zip + 4,每天限制 5000 个请求。
USPS 有一个用于查找/检查邮政编码(除其他外)的 API。
我在过去的工作中使用过 Endicia。它是一个基于网络 HTTP 的 API。(我不记得是 SOAP 还是 REST。)
Apple provide brilliant facility to get zip+4code from lattitude and longitude with reverse geocoder -
- (void)getPlaceMarkInfo
{
CLLocationCoordinate2D coordinate;
coordinate.latitude = your lattitude;
coordinate.longitude = your longitude;
MKReverseGeocoder *RevGeoCoder = [[MKReverseGeocoder alloc] initWithCoordinate:coordinate];
RevGeoCoder.delegate = self;
[RevGeoCoder start];
}
#pragma mark MKReverseGeocoderDelegate:
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark
{
NSLog(@"YOUR STATE IS - %@",[placemark.addressDictionary valueForKey:@"State"]);
NSDictionary *dictAddress = placemark.addressDictionary;
NSString *strZipPlus4Code = [NSString
stringWithFormat:@"%@-%@",[dictAddress valueForKey:@"ZIP"],
[dictAddress valueForKey:@"PostCodeExtension"]];
strStateName = [placemark.addressDictionary valueForKey:@"State"];
}
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error
{
NSLog(@"REVERSE GEOCODER FAILED");
}
以前的答案包括一些非常好的信息,最重要的是:
你还说你想要一些不需要安装和保持更新的东西。
考虑到这些条件,我建议LiveAddress API。它是一个基于云的自动更新 API,可在 40 多个其他数据点中返回您地址上的 ZIP+4 数据。它每秒可以处理数千个地址,因此超级快速且易于使用。如果您有一个想要工作的地址列表(而不是一次一个),您可能需要LiveAddress for Lists,它可以让您一次上传和处理整个列表。
披露:我在提供 LiveAddress 的公司 SmartyStreets 工作。
参考 Yahoo BOSS GEO Api:
http://yboss.yahooapis.com/geo/placefinder?location=170+South+Market+St.,+San+Jose,+CA
使用以下授权 HEADER 发出 GET 请求
在 HTTP Header 中使用 OAuth 的示例:
Authorization: OAuth realm="http://yboss.yahooapis.com/",oauth_consumer_key="dj0yJmk9QnFUYVRUSWtRZEhsJmQ9WVdrOVFrYzFja2x4TkdNbWNHbzlNVEExTWpFMk1ESTJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD1lNA--",oauth_nonce="ZDQDDVLFCWKCZ0BD",oauth_signature_method="HMAC-SHA1",oauth_timestamp=" 1367827192",oauth_version="1.0 ",oauth_signature="phP2dNiCmvwpK4M6G%2F85KnnvTXo%3D"
在哪里:
BOSS Geo 查询的身份验证需要 HTTP 标头中的 OAuth 信息或通过 GET 请求中的参数。授权需要六个要素:
oauth_version=1.0 – The standard of OAuth supported by BOSS Geo.
oauth_timestamp= – The timestamp is expressed in the number of seconds since January 1, 1970 00:00:00 GMT. The timestamp value MUST be a positive integer and MUST be equal to or greater than the timestamp used in previous requests. The timestamp can be reused for up to 5 minutes. Important: After 5 minutes a fresh timestamp must be supplied.
oauth_nonce – is a random string, uniquely generated for all requests for a specific timestamp. This helps verify that a request has never been made before and helps prevent replay attacks when requests are made over a non-secure channel (such as HTTP).
oauth_consumer_key= – obtained from YDN during the BOSS project registration process. This is unique to the developer. Please follow the directions on the displayed key page and copy the entire key from YDN. If you do not copy the entire key, this results in a "Consumer Key rejected" error.
oauth_signature_method=HMAC-SHA1 – (specific algorithm used for BOSS OAuth calls).
oauth_signature – can be generated by an OAuth library. A list of supported OAuth libraries is available here: http://oauth.net/code. Over a dozen languages are supported.
您将在“邮政编码”键下的响应中获得 zip+4 代码。