Configure Polyline Quality

The quality of a polyline can be described in the following terms:

The number of points that make up the polyline
The more points there are, the smoother the polyline (especially in curves).
The floating-point precision of the points
Points are specified as latitude and longitude values, which are represented in single-precision floating-point format. This works well for small values (which can be represented precisely), but precision decreases as values increase because of floating-point rounding errors.

Specifying polyline quality

When you call the ComputeRoutes() method, you use a PolylineQuality enumeration value to specify the quality of the polyline.

Use the HIGH_QUALITY value when you want to create a polyline composed of the maximum number of points, to produce a polyline of the highest resolution. This increased quality comes at the expense of response latency.

Use the OVERVIEW value when you want to create a low-resolution overview of the route, which is a polyline composed of a minimal number of points. This option produces responses with the lowest latency.

Example

The following example demonstrates how to set the polyline quality in the request body.

{
  "origin":{
    "location":{
      "latLng":{
        "latitude":37.419734,
        "longitude":-122.0827784
      }
    }
  },
  "destination":{
    "location":{
      "latLng":{
        "latitude":37.417670,
        "longitude":-122.079595
      }
    }
  },
  "polylineQuality":"HIGH_QUALITY"
}