Overlays

Overview

You can enhance your maps by adding overlays, shapes that appear over the map. There are three overlay shapes:

These three objects can satisfy a wide variety of applications, such as outlining routes, highlighting map areas, enabling users to make selections, and more.

To display an overlay, you provide geometry data that determines the overlay's shape, and a style that determines its visual representation. For example, a circle's center and radius define its geometry. The coordinates of a polygon's vertices define its shape. The style specifies how the overlay is drawn, including its fill color, outline color, and opacity.

Overlays are dynamic. They are redrawn automatically if their underlying geometry or style data change; for example, a circle's radius can grow, or a polygon's fill color can update dynamically. This makes overlays a powerful visualization tool. For example, circles can show the spread of an infectious disease over a span of time.

Overlays belong to their own layer that sit above map tiles and below annotations. The order in which overlays are added to a map is significant. In the event that multiple overlays overlap, overlays that are added later are higher in the Z-order (that is, closer to the foreground).

Create Interactive Map Overlays

You can make an overlay interactively selectable, so users can tap or click to select it. Ensure that the overlay is:

  • Enabled.

  • Present on the map, and not so small that it can't be drawn.

  • At least partially contained within the visible map rectangle.

Additionally the overlay must have the following settings:

  • A fill color that is not null (enabling a tap inside the overlay), or

  • A stroke color that is not null with a line width greater than 0 (enabling a tap on the overlay's outline.)

To make an overlay transparent and selectable, set the opacity of the fill or stroke to 0.

Topics

Overlays

mapkit.Overlay

An abstract base object that defines the methods and attributes for map overlays.

mapkit.Style

A set of observable attributes for overlays, including color and opacity of stroke and fill, and line styles.

mapkit.CircleOverlay

A circular overlay with a configurable radius, centered on a specific geographic coordinate.

mapkit.PolylineOverlay

An overlay made up of connected line segments that do not form a closed shape.

mapkit.PolygonOverlay

An overlay made up of one or more points, forming a closed shape.

OverlayOptions

A dictionary of options that determine an overlay's data and if it is visible, enabled, and selected.

Tile Overlay

mapkit.TileOverlay

An overlay that covers an area of the map with bitmap tiles.

See Also

Annotations and Overlays