Chapter 4. Working with Controls

In this chapter, we will cover:

  • Adding and removing controls
  • Changing the position of controls
  • Creating and adding a geolocation control
  • Creating a table of contents control for layers
  • Adding your own logo as a control

Introduction

This chapter covers the controls that are found in the Google Maps JavaScript API. Generally speaking, controls are UI elements that interact with the user. At a very basic level, they comprise of simple HTML elements or a combination of them.

Controls enable the user to pan the map, zoom in or out, measure distances or areas, and so on. Complex controls involve the administration of multiple overlay layers (introduced in Chapter 2, Adding Raster Layers) in the form of a table of contents

Get Google Maps JavaScript API Cookbook now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.