从地址获取zip +4的最佳api /资源是什么?
我不想要一些需要不时下载和更新的东西;我想要一个自动更新的。
目标是在没有“重复”职位的情况下查找州和联邦官员。
答案 0 :(得分:6)
你试过Google Maps JavaScript API V3
吗?<强>更新:强>
回应你的评论
这很容易,因为计数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);
});
});
答案 1 :(得分:3)
雅虎有一个zip + 4的API,每天限制5000个请求。
答案 2 :(得分:2)
USPS有一个用于查找/检查邮政编码的API(以及其他内容)。
答案 3 :(得分:2)
我在过去的工作中使用过Endicia。它是基于HTTP的网络API。 (我不记得它是SOAP还是REST。)
答案 4 :(得分:1)
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");
}
答案 5 :(得分:1)
以前的答案包含了一些非常好的信息,最重要的是:
你还说你想要一些不需要安装和保持更新的东西。
考虑到这些资格,我建议LiveAddress API。它是一个基于云的自动更新的API,可以在40多个其他数据点中返回您地址上的ZIP + 4数据。它可以处理数千个每秒的地址,因此它非常快速且易于使用。如果您有一个想要工作的地址列表(而不是一次一个),您可能需要LiveAddress for Lists,这样您就可以一次上传和处理整个列表。
披露:我在SmartyStreets工作,该公司提供LiveAddress。
答案 6 :(得分:0)
参考Yahoo BOSS GEO Api:
http://yboss.yahooapis.com/geo/placefinder?location=170+South+Market+St.,+San+Jose,+CA
使用以下授权HEADER
发出GET请求在HTTP标头中使用OAuth的示例:
授权:OAuth的境界= “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.
您将在“postalcode”键下的Response中获得zip + 4代码。