Place Autocomplete Address Form

Samples may not be available in your region.

The Place Autocomplete Address Form sample captures
selected address components from the Google Places database, and uses them
to populate an address form.

Since this sample only requires a place address in a structured format,
the sample code uses just one place data field:
address_components. The requested place data fields affect the
cost of each request.
You can specify which place data fields to return by calling
Autocomplete.setFields(),
and specifying one or more
place data fields.

Caution: If you don't call
Autocomplete.setFields(), then all of the available
place data fields for a place result are returned, and you are billed for
all of them.

The address components in this sample are based on a typical address
format. Note that you might need to use a different set of components to
align with the postal address formats used in some regions. For example,
the sample code selects the locality component, which often
represents the city part of the address. Examples of how components
can differ include:

In the UK and in Sweden, the component to display the city is
postal_town.

In Japan, components differ across prefectures.

Brooklyn and other parts of New York City do not include the city as
part of the address. Instead, they use sublocality_level_1.