Routes Preferred API 目前僅適用於特定客戶。如需瞭解詳情,請
聯絡銷售人員。
設定折線品質
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
折線的品質可以用下列詞彙說明:
- 構成折線的點數
- 點越多,折線越平滑 (尤其是在彎曲處)。
- 點的浮點精確度
- 點是以經緯度值指定,並以單精度浮點格式表示。這項做法適用於小值 (可精確表示),但由於浮點數四捨五入錯誤,值越大精確度就越低。
指定折線品質
呼叫 ComputeRoutes()
方法時,請使用 PolylineQuality
列舉值指定折線的品質。
如要建立由最多點數組成的折線,產生最高解析度的折線,請使用 HIGH_QUALITY
值。但回覆延遲時間會因此增加。
如要建立路徑的低解析度總覽,也就是由最少數量的點組成的折線,請使用 OVERVIEW
值。這個選項產生的回覆延遲時間最短。
範例
以下範例說明如何在要求主體中設定折線品質。
{
"origin":{
"location":{
"latLng":{
"latitude":37.419734,
"longitude":-122.0827784
}
}
},
"destination":{
"location":{
"latLng":{
"latitude":37.417670,
"longitude":-122.079595
}
}
},
"polylineQuality":"HIGH_QUALITY"
}
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-09-13 (世界標準時間)。
[null,null,["上次更新時間:2025-09-13 (世界標準時間)。"],[],["Polyline quality depends on the number of points and their floating-point precision. The `ComputeRoutes()` method uses `PolylineQuality` to set this. `HIGH_QUALITY` creates a polyline with the maximum points, resulting in high resolution but increased latency. `OVERVIEW` generates a low-resolution polyline with minimal points, reducing latency. The request body sets `polylineQuality` to specify either `HIGH_QUALITY` or `OVERVIEW`, which will influence the polyline's precision.\n"],null,[]]