Home > Articles

  • Print
  • + Share This
From the author of

Adding Map Controls

You may have noticed that the map you created is just a map—it doesn’t include any controls that let users zoom around or into or out of the default location. That’s fine if you want a static map (of your company’s headquarters, let’s say), but if you want to make the map interactive, you have to add the appropriate map controls. You do this by adding the following lines of code between the var map and map.setCenter lines in the <HEAD> of your document:

map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());

The resulting map now includes the expected right, left, up, down, and zoom in/zoom out controls—as well as the Map/Satellite/Hybrid display controls.

  • + Share This
  • 🔖 Save To Your Account