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!