Get Total Address Information with Geocode API
Getting address information is vitally important. Whether shipping a package, tailoring a user experience to location, or using that data to help localize language on a website, getting location information wrong can lose a sale or brake feature. Let's take a look at an API I recently found which helps me get all the detailed geolocation information I need: Geocode API.
Quick Hits
- Useful for verifying addresses, using data to calculate shipping rates, and mapping
- Provides detailed data but very easy to use
- Get address data for anywhere in the world
- Support for implementation and integration
- 99.9% uptime guaranteed
- From the amazing creators behind Zenserp
- Get started for free!
Using Geocode API
Start by signing up for Geocode API for free!
First note that you can send the API key via URL or via header:
curl "https://app.geocodeapi.io/api/v1/search" -H "apikey: APIKEY" curl "https://app.geocodeapi.io/api/v1/search?apikey=APIKEY" curl "https://app.geocodeapi.io/api/v1/search" -F "apikey=APIKEY"
The core of Geocode API's functionality runs through the /v1/search/
endpoint with only a text
parameter and the API key:
curl "https://app.geocodeapi.io/api/v1/search?text=Madison+WI+Capitol&apikey=APIKEY"
In my example above, I provide the API only the term "Madison, WI Capitol". The resulting payload is filled with great detail; here are some highlights of the response:
{ "id": "relation/7144092", "gid": "openstreetmap:venue:relation/7144092", "layer": "venue", "source": "openstreetmap", "source_id": "relation/7144092", "name": "University of Wisconsin-Madison", "confidence": 0.8, "match_type": "fallback", "accuracy": "point", "country": "United States", "country_a": "USA", "region": "Wisconsin", "region_a": "WI", "localadmin": "Madison", "neighbourhood": "College Hills", "continent": "North America", "label": "University of Wisconsin-Madison, Madison, WI, USA", "addendum": { "osm": { "wikidata": "Q838330", "wikipedia": "en:University of Wisconsin–Madison" } } }
I was really impressed by the neighborhood data it included! You can even use broader search terms like my hometown restaurant and first employer -- "McFarland WI Culver's":
curl "https://app.geocodeapi.io/api/v1/search?text=McFarland+Culvers&apikey=APIKEY" { "id": "way/572463175", "gid": "openstreetmap:venue:way/572463175", "layer": "venue", "source": "openstreetmap", "source_id": "way/572463175", "name": "Culver's", "housenumber": "4700", "street": "Farwell Street", "confidence": 0.8, "match_type": "fallback", "accuracy": "point", "country": "United States", "country_gid": "whosonfirst:country:85633793", "country_a": "USA", "region": "Wisconsin", "region_gid": "whosonfirst:region:85688517", "region_a": "WI", "localadmin": "Mcfarland", "localadmin_gid": "whosonfirst:localadmin:404493259", "neighbourhood": "South Central Side", "neighbourhood_gid": "whosonfirst:neighbourhood:85878883", "continent": "North America", "continent_gid": "whosonfirst:continent:102191575", "label": "Culver's, Mcfarland, WI, USA" }
You don't need the exact address to get a reliable result -- simply provide a human-friendly term and you get accurate address information. In the case that you may return multiple locations, like "McDonalds Madison, WI", you can limit the result size:
[code shell text=McDonalds + Madison + WI
+ size: 10
]
curl "https://app.geocodeapi.io/api/v1/search?text=McDonalds+Madison&size=10&apikey=APIKEY"
Geocode API provides a great mix of search results, location detail and customization, and trust in result. The results provided feel like a Google search married with localization.