Routes Preferred API is currently available only to select customers.
Contact sales to learn more.
Configure Polyline Quality
Stay organized with collections
Save and categorize content based on your preferences.
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"
}
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-02-20 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-20 UTC."],[[["Polyline quality is determined by the number of points and their floating-point precision, impacting smoothness and accuracy."],["`HIGH_QUALITY` setting yields the most detailed polyline with maximum points, potentially increasing response time."],["`OVERVIEW` setting creates a simplified polyline with minimal points, prioritizing faster response."],["You can adjust the polyline quality using the `PolylineQuality` enumeration when making API requests, as shown in the example."]]],[]]