usps_zipcode_lookup Function
Syntax
Arguments
- ZipCode
A 9 digit ZIP code
- addr1
The street portion of an address.
- city
The city portion of an address.
- state
The state portion of an address.
- addr2
Optional. Default = "". A second street address.
- urbanization
Optional. Default = "". Urbanization denotes an area, sector, or development within a geographic area. In addition to being a descriptive word, it precedes the name of the area. The URB descriptor, commonly used in Puerto Rican urban areas, is an important part of the addressing format of Puerto Rico, as it describes the location of a given street.
- zip5
Optional. Default = "". A 5 or 9 digit ZIP code. The function truncates 9 digit codes to 5 digits.
Description
Looks up the zip code for the specified address. Returns "" if the zip is not found. Returns the first zip code if multiple are available for the specified address.
Discussion
The USPS_ZipCode_Lookup() function looks up the ZIP code for the specified address using the OpenCage geocoding service. The function returns "" (NULL) if the ZIP code is not found. It returns the first ZIP code if multiple are available for the specified address. Note: Use of this function requires an active Internet connection.
NOTE - In builds prior to 9773, this function contacted the USPS web site directly.
Example
? usps_zipcode_lookup("70 blanchard road", "burlington", "ma")
= "01803-5100"
? usps_zipcode_lookup("91 Middlesex Turnpike", "burlington", "ma")
= "01803-4922"
? usps_zipcode_lookup("1600 Pennsylvania Avenue NW", "Washington", "DC")
= "20500-0003"See Also