Place Autocomplete

Stay organized with collections Save and categorize content based on your preferences.

The Place Autocomplete sample demonstrates how to use the Place Autocomplete widget to provide a type-ahead search box.

  • The radio buttons allow you to filter the types of predictions that the autocomplete returns.
  • The Strict Bounds option restricts the search to the area within the current viewport. If this option is not checked, then the API biases the search to the current viewport, but it does not restrict it.

When you select an autocomplete result the sample then calls the getPlace() method, and then it opens an info window to display place details.

For more information, see the Autocomplete class.

Try Sample

Clone Sample

Git and Node.js are required to run this sample locally. Follow these instructions to install Node.js and NPM. The following commands clone, install dependencies and start the sample application.

  git clone -b sample-places-autocomplete
  cd js-samples
  npm i
  npm start

Other samples can be tried by switching to any branch beginning with sample-SAMPLE_NAME.

  git checkout sample-SAMPLE_NAME
  npm i
  npm start