Working with shapes

Google Maps for Android allows us to add custom shapes in our map application. The three ways supported are as follows:

  • Polyline
  • Polygon
  • Circle

Let's understand these methods now.

Polyline

Polyline is a set of points where line segments are drawn between consecutive points. For example, you can give a set of latitude, longitude coordinates as input, and lines are drawn connecting these points.

The following image is an example of a polyline that connects two points:

Polyline

The Polyline object consists of a set of latitude, longitude coordinates and it connects the points to each other.

Creating a polyline

A polyline can be created using a PolylineOptions ...

Get Learning Android Google Maps now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.