The Place ID Geocoder sample uses the Place Autocomplete widget to allow a user to search for a place. After it retrieves the place details, the sample marks the place on the map, then reverse geocodes the place ID to get the place's geographic coordinates. Finally, the sample displays an info window that contains details about the place (name, place ID, and formatted address).
Read the documentation.
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-placeid-geocoder https://github.com/googlemaps/js-samples.git
Other samples can be tried by switching to any branch beginning with
git checkout sample-SAMPLE_NAME