来自地址的 zip +4 的 api

发布于 2024-09-01 07:02:46 字数 104 浏览 7 评论 0原文

从地址获取 zip +4 的最佳 api/资源是什么?

我不想要需要时不时下载和更新的东西;我想要一个自动更新的。

目标是查找州和联邦官员而不得到“重复”的职位。

What's the best api/resource to get a zip +4 from an address?

I don't want something that needs to be downloaded and updated from time to time; I want one that's updated automagically.

The goal is to look up state and federal officials without getting "duplicate" positions.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

╰沐子 2024-09-08 07:02:46

您是否尝试过 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);
    });
});

have you tried Google Maps JavaScript API V3

UPDATED:

in responce to your comment

this is easy as count 1, 2 , 3 ;)

take a look at this:

you need to looking for google map geocoding service! ( Viewport Biasing )

example code would be:

using 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);
    });
});
夏了南城 2024-09-08 07:02:46

雅虎的 API 中有一个 zip + 4,每天限制 5000 个请求。

雅虎地理编码

Yahoo has a zip + 4 in thier API, limit 5000 request per day.

Yahoo GeoCoding

岁月静好 2024-09-08 07:02:46

USPS 有一个用于查找/检查邮政编码(除其他外)的 API。

http://www.usps.com/webtools/address.htm

The USPS has an API for finding/checking zip codes (among other things).

http://www.usps.com/webtools/address.htm

悲歌长辞 2024-09-08 07:02:46

我在过去的工作中使用过 Endicia。它是一个基于网络 HTTP 的 API。 (我不记得是 SOAP 还是 REST。)

I've used Endicia at past jobs. It is a network HTTP-based API. (I can't remember if it was SOAP or REST.)

给不了的爱 2024-09-08 07:02:46
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");

}
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");

}
醉城メ夜风 2024-09-08 07:02:46

之前的答案包含了一些非常好的信息,最重要的是:

  • 只有通过 USPS 发货时才能使用 USPS API(来自他们的 服务条款:“用户同意使用 USPS 网站、API 和 USPS 数据仅用于促进 USPS 运输交易。”)
  • 邮政编码的调整/更新相当频繁,因此重要的是最新数据。 (有关重新验证地址的频率的更多信息 这里

您还说过您想要一些不需要安装和保持更新的东西。

考虑到这些条件,我建议使用 LiveAddress API。它是一个基于云的自动更新 API,可返回您地址上的 ZIP+4 数据以及 40 多个其他数据点。它每秒可以处理数千个地址,因此速度超快且易于使用。如果您有一份想要使用的地址列表(而不是一次一个),您可能需要 LiveAddress for Lists,让您可以一次上传和处理整个列表。

披露:我在 SmartyStreets 工作,这是一家提供 LiveAddress 的公司。

Previous answers have included some really good information, most importantly:

  • USPS API can only be used if you're shipping through USPS (from their terms of service: "User agrees to use the USPS Web site, APIs and USPS data to facilitate USPS shipping transactions only.")
  • ZIP Codes are adjusted/updated fairly frequently, so it would be important to have the most current data. (More info about how often to re-validate your addresses here)

You also said you want something that doesn't need to be installed and kept updated.

With those qualifications in mind, I would suggest LiveAddress API. It's a cloud-based, automatically updated API that returns, among over 40 other datapoints, ZIP+4 data on your addresses. It can handle thousands of addresses per second, so it's super-fast and easy to use. If you have a list of address you want to work though (rather than one at a time), you might want LiveAddress for Lists, which lets you upload and process a whole list at once.

Disclosure: I work at SmartyStreets, the company that provides LiveAddress.

是你 2024-09-08 07:02:46

参考 Yahoo BOSS GEO Api:

http://yboss.yahooapis.com/geo/placefinder?location=170+South+Market+St.,+San+Jose,+CA

使用以下授权 HEADER 发出 GET 请求

使用 OAuth 的示例在 HTTP 标头中:

授权:OAuth 领域 =“http://yboss.yahooapis.com/”,oauth_consumer_key =“dj0yJmk9QnFUYVRUSWtRZEhsJmQ9WVdrOVFrYzFja2x4TkdNbWNHbzlNVEExTWpFMk1ESTJNZy0tJnM9Y29uc3VtZXJzZWNyZXQ meD1lNA--",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 代码。

In reference of Yahoo BOSS GEO Api:

http://yboss.yahooapis.com/geo/placefinder?location=170+South+Market+St.,+San+Jose,+CA

Make a GET request with following authorization HEADER

Example of using OAuth in HTTP Header:

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"

where:

Authentication for BOSS Geo queries requires OAuth information in the HTTP header OR through parameters in the GET request. There are six elements that are required for authorization:

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.

You will get zip+4 code in Response under "postalcode" key.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文