Overlays

Get an overview of drawing and adding overlay objects to a map that can highlight points, lines, or areas.

We'll cover the following

The Maps JavaScript API allows us to add objects to a map so that points, lines, or areas can be identified. These objects are called overlays and are tied to the latitude and longitude coordinates.

Overlay types

The following table summarises the different types of overlays that can be programmatically added to a map:

Type

Description

Marker

Displays a single location on a map.

Info Window

Displays content, usually text or images, within a popup at a given location on a map.

Polyline

Displays lines on the map to represent an ordered sequence of locations.

Polygon

Displays areas of arbitrary shapes on a map.

Circle and Recatngle

Display circle and rectangle objects on a map.

Overlays are a good way to customize a map and add interactivity to it. Overlays are tied to the latitude and longitude coordinates, so they move whenever zooming or dragging occurs on the map.