Viewport
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
經緯度可視區域,以兩個對角相反的 low
和 high
點表示。可視區域視為封閉區域,也就是包含邊界。緯度範圍必須介於 -90 到 90 度之間 (含首尾),經度範圍則需介於 -180 到 180 度之間 (含首尾)。各種情況包括:
如果 low
= high
,可視區域就會包含該單一點。
如果 low.longitude
> high.longitude
,經度範圍會反轉 (可視區域會跨越 180 度經線)。
如果 low.longitude
= -180 度,且 high.longitude
= 180 度,則可視區域會包含所有經度。
如果 low.longitude
= 180 度且 high.longitude
= -180 度,則經度範圍為空白。
如果 low.latitude
> high.latitude
,則緯度範圍為空白。
low
和 high
都必須填入資料,且代表的方塊不得為空白 (如上述定義所述)。空白的檢視區會導致錯誤。
舉例來說,這個檢視區會完全包含紐約市:
{ "low": { "latitude": 40.477398, "longitude": -74.259087 }, "high": { "latitude": 40.91618, "longitude": -73.70018 } }
JSON 表示法 |
{
"low": {
object (LatLng )
},
"high": {
object (LatLng )
}
} |
欄位 |
low |
object (LatLng )
必要欄位。可視區域的低點。
|
high |
object (LatLng )
必要欄位。可視區域的高點。
|
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-31 (世界標準時間)。
[null,null,["上次更新時間:2025-08-31 (世界標準時間)。"],[],[],null,["# Viewport\n\n- [JSON representation](#SCHEMA_REPRESENTATION)\n\nA latitude-longitude viewport, represented as two diagonally opposite `low` and `high` points. A viewport is considered a closed region, i.e. it includes its boundary. The latitude bounds must range between -90 to 90 degrees inclusive, and the longitude bounds must range between -180 to 180 degrees inclusive. Various cases include:\n\n- If `low` = `high`, the viewport consists of that single point.\n\n- If `low.longitude` \\\u003e `high.longitude`, the longitude range is inverted (the viewport crosses the 180 degree longitude line).\n\n- If `low.longitude` = -180 degrees and `high.longitude` = 180 degrees, the viewport includes all longitudes.\n\n- If `low.longitude` = 180 degrees and `high.longitude` = -180 degrees, the longitude range is empty.\n\n- If `low.latitude` \\\u003e `high.latitude`, the latitude range is empty.\n\nBoth `low` and `high` must be populated, and the represented box cannot be empty (as specified by the definitions above). An empty viewport will result in an error.\n\nFor example, this viewport fully encloses New York City:\n\n{ \"low\": { \"latitude\": 40.477398, \"longitude\": -74.259087 }, \"high\": { \"latitude\": 40.91618, \"longitude\": -73.70018 } }\n\n| JSON representation |\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"low\": { object (/maps/documentation/geocoding/reference/rest/Shared.Types/LatLng) }, \"high\": { object (/maps/documentation/geocoding/reference/rest/Shared.Types/LatLng) } } ``` |\n\n| Fields ||\n|--------|-----------------------------------------------------------------------------------------------------------------------------------|\n| `low` | `object (`[LatLng](/maps/documentation/geocoding/reference/rest/Shared.Types/LatLng)`)` Required. The low point of the viewport. |\n| `high` | `object (`[LatLng](/maps/documentation/geocoding/reference/rest/Shared.Types/LatLng)`)` Required. The high point of the viewport. |"]]