Read the labs blog
SunlightLabs API
places.getLatLongFromZip
Get the latitude and longitude from a 5 digit zip code
Arguments
These are all $_GET parameters.
zip (required)
The 5 digit zipcode
apikey (required)
your individual API key
metadata (optional)
&metadata=true provides detail about source, last update of the information etc. Click here for details
output (optional)
&output=json is set by default. You can also use &output=xml
Example Call
http://api.sunlightlabs.com/places.getLatLongFromZip.php?zip=20740 &apikey=23kj234kjb3kjbcl87ds
says give me the abbreviation of the state containing the zipcode 20740.
Example Response
For the default JSON:
{ "zip" : "20740", "latitude" : "38.997560", "longitude": "-76.925770" }
For XML:
<results> <zip>20740</zip> <latitude>38.997560</latitude> <longitude>-76.925770</longitude> </results>
Error Codes
If there is an error: a plain text string will be returned:
100: invalid API key
The API key was invalid
101: API key not valid for this method
Not permitted to call this particular method with this particular API key
205: invalid zip5
The zip5 was not valid

