api for zip +4 from an address
Asked Answered
V

7

6

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.

Vaudevillian answered 8/5, 2010 at 1:13 Comment(0)
T
3

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

Yahoo GeoCoding

Teodor answered 1/6, 2010 at 17:34 Comment(1)
This API is now deprecated. It was replaced by Placefinder. Now that is being replaced by BOSS Geo service. They say "We continue to offer a rate limited YQL table for Placefinder and Placemaker for non-commercial use. The free REST api's will no longer be actively supported."Omnipotence
A
6

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);
    });
});
Aleishaalejandra answered 6/6, 2010 at 21:48 Comment(5)
I'd love to use a google service, but I've not spent the time to figure out how to feed it an address and get back a "sanitized" address.Vaudevillian
I'm after zip+4. It doesn't look like Google exposes that data if they have it, but thanks for the example.Vaudevillian
just for curiosity can you give me an example address you should search!?Aleishaalejandra
"1030 florida ave lynchburg" should return a zip + 4 of 24504-4809, ex: local.yahooapis.com/MapsService/V1/…Vaudevillian
seams like there is a reason for that groups.google.com/group/Google-Maps-API/browse_thread/thread/… but of course depend on what you need!!Aleishaalejandra
T
3

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

Yahoo GeoCoding

Teodor answered 1/6, 2010 at 17:34 Comment(1)
This API is now deprecated. It was replaced by Placefinder. Now that is being replaced by BOSS Geo service. They say "We continue to offer a rate limited YQL table for Placefinder and Placemaker for non-commercial use. The free REST api's will no longer be actively supported."Omnipotence
M
2

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

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

Multipara answered 1/6, 2010 at 17:59 Comment(1)
you're only allowed to use it if you're shipping through USPS though. I've been rejected for an API key at least twice(with honest answers).Vaudevillian
P
2

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

Pantsuit answered 3/6, 2010 at 19:12 Comment(1)
I think it is called dial a zip.Cymry
D
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");

}
Deranged answered 10/5, 2013 at 11:19 Comment(0)
R
1

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.

Recommendation answered 10/5, 2013 at 16:2 Comment(0)
D
0

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.

Deranged answered 6/5, 2013 at 9:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.