This blog post was written by Nick McBurney and published 26th April 2018.
I work with application forms daily and often specifically address lookup and input population functions. I had read about the Google Maps API years ago but never looked into it, and having been working on an address lookup API recently it reminded me of the service, so I decided to have a look at the Autocomplete API.
Its not suitable for everything
The API uses data from Google Maps, which has lots of missing data (flats, businesses, rural addresses etc) so might not be suitable if you need accurate addresses and don’t want to frustrate users who can’t find their address.
So I decided to dig in! I copied the demo code into CodePen and had a look at the object returned, which included a ‘premise’ property containing the information missing from the demo. I added an input for the new property and included the property name and format into the
componentForm object – which is used to handle the information returned.