Restricting Map Extent / Bounds in the Google Maps API

This quick tutorial demonstrates how to easily restrict the viewable and pannable area in a Google Map. The Google Maps API lacks a built-in feature to control the map extent (i.e., the bounds) to which someone can pan. However, my undergraduate student (Kyle Wilms) found a simple 12-line code to do this.

The text file you can copy and paste is available here:

JavaScript File for Limiting Bounds in Google Maps (1.2 KiB)

The demo video is available on my YouTube Channel or below.

 

You were saying?