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:
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
nullwith 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