This example creates a map that starts in Auckland, New Zealand. The map is restricted to New Zealand. The user can pan away from Auckland and explore other New Zealand cities, but the user cannot pan or zoom to beyond the constraints set on the map.
Try panning north, or zooming out, to see what happens when a user tries to move beyond these boundaries.
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-control-bounds-restriction https://github.com/googlemaps/js-samples.git
Other samples can be tried by switching to any branch beginning with
git checkout sample-SAMPLE_NAME