Google Places Query Autocomplete is a new feature available as part of both the Google Places API and the Google Maps JS API Places Library. This feature has the same type-ahead-search behavior of the original Place Autocomplete, but just like the Google Maps search field, it returns places, addresses, and popular queries, such as “italian restaurants” or “swimming pool.”
Autocomplete Data Services
In the Places Library of the Google Maps JS API, we first offered Place Autocomplete as a drop-down widget that’s bound to an input element. We wanted to give developers more flexibility, so both Place Autocomplete and Query Autocomplete now have data services that return predictions in a JSON collection. With this collection, you have complete control over your text inputting and autocomplete experience while using the Google Maps JS API.
This control allows for mixing in your own predictions, such as the user’s home location or her favorite restaurant, or styling predictions to better match your application. In the demo below, we used the data service to give our predictions some rotating Google-themed colors.
Our Autocomplete services do not need to be used in conjunction with a map, but it does require a “powered by Google” logo to appear under the text field if a map isn’t shown.
The Google Places API autocomplete services are here as part of our goal to make location-based textual input an effortless experience. Give them a try and let us know what you think!
Posted by Paul Saxman, Google Maps Developer Advocate
P.S. Submissions for the Places API Developer Challenge are now open. Build an app to help your community and for a chance to win tickets for Google I/O!