Viewport
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
วิวพอร์ตละติจูด-ลองจิจูดที่แสดงเป็นจุด low
และ high
2 จุดที่ตรงข้ามกันตามแนวทแยงมุม วิวพอร์ตถือเป็นภูมิภาคแบบปิด กล่าวคือ วิวพอร์ตจะมีขอบเขตของตัวเอง ขอบเขตละติจูดต้องอยู่ในช่วง -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 )
ต้องระบุ จุดสูงสุดของวิวพอร์ต
|
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-31 UTC
[null,null,["อัปเดตล่าสุด 2025-08-31 UTC"],[],[],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. |"]]