Geocoding and Autocomplete Search¶
The Stadia Maps geocoding and autocomplete search APIs help you convert between places and geographic coordinates. Places include points of interest (ex: Times Square), businesses, street addresses, postal codes, and more (see our list of layers).
-
Forward Geocoding
Search for places by name or address and get their location, website, postal code, and more.
Pärnu mnt 388b
59.381096, 24.661382
-
Autocomplete Search
Build interactive search-as-you-type user experiences to help users get results faster.
New
New York
-
Structured Geocoding
Search for places using structured address components rather than free-form text.
address: 11 Wall Street, borough: Manhattan
40.707141, -74.010865
-
Bulk Geocoding
Geocode thousands of addresses quickly with a single API call.
[Pärnu mnt 388b, 11 Wall Street]
[(59.381096, 24.661382), (40.707141, -74.010865)]
-
Reverse Geocoding
Find out where you are: nearby addresses, city, state, and more.
59.381096, 24.661382
Pärnu mnt 388b
-
Place Lookup
Get details on a place via its GID. Useful for looking up details of related places in a response.
openstreetmap:venue:way/5013364
Eiffel Tower
Best Practices¶
Tip
Skim this section first! Following a few simple tips will help you and your users get the most relevant results.
Tip 1: Pick the Best Endpoint¶
I want Place Information from Geographic Coordinates¶
If you have geographic coordinates and want to find out what's nearby, then the choice is easy! Use the reverse endpoint.
I'm Building an Interactive Search Interface¶
The autocomplete endpoint is designed to work on partial inputs. If you are creating an interactive UI where users see results as they type, use autocomplete for most queries. You can switch to the search endpoint after the user presses enter/return.
I Want to Search for a Place using a String¶
If you have a set of addresses or other well-described place names (like a city or street name; ex: Peach Street, Erie, PA
),
use the search endpoint.
This works similarly to the autocomplete endpoint, but will return much better results on "complete" input
(ex: after the user presses the enter/return key in an autocomplete search box, or submits a form).
The search endpoint (and only the search endpoint) is capable of interpolating missing house numbers along a street.
I have Structured Data¶
If your data is already broken up into logical address chunks like postal code, city, and street address, the structured search endpoint is usually the best choice. It behaves similarly to the search endpoint, but you can specify the address components upfront, bypassing our parser.
Tip 2: Specify which Layers you Need¶
All of our data is broken into layers, which separate data of different types. Examples of layers are
country
, venue
(businesses, points of interest, etc.), and postalcode
. Removing unneeded layers will give you
more relevant results and better performance. Check out the complete list in our layers documentation.
Tip
Our search endpoint is able to interpolate addresses which don't have exact matches in our database. This capability relies on conflating data from multiple sources, so if you are searching for addresses and have reasonably complete user input (ex: the user pressed enter/return or submitted a form), you should prefer using the search endpoint without layer filtering.
Tip 3: Focus your Search Geographically¶
Only dealing with US & Canadian addresses? Set boundary.country
. Using the map as a viewport to bias results?
Enforce a minimum map zoom if you can before setting focus.point
or boundary.rect
properties. You get the idea.
Read the endpoint documentation for details of the available parameters.
Tip 4: The API Gives you Hints!¶
The API gives a lot of hints back to you as well! Check out our documentation on determining result quality to learn about these cues.