Map.setCenter
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
จัดกึ่งกลางมุมมองแผนที่ที่พิกัดที่ระบุด้วยระดับการซูมที่ระบุ
แสดงแผนที่
การใช้งาน | การคืนสินค้า |
---|
Map.setCenter(lon, lat, zoom) | ui.Map |
อาร์กิวเมนต์ | ประเภท | รายละเอียด |
---|
lon | ตัวเลข | ลองจิจูดของจุดกึ่งกลาง หน่วยเป็นองศา |
lat | ตัวเลข | ละติจูดของจุดศูนย์กลาง หน่วยเป็นองศา |
zoom | หมายเลข (ไม่บังคับ) | ระดับการซูมตั้งแต่ 0 ถึง 24 |
ตัวอย่าง
โปรแกรมแก้ไขโค้ด (JavaScript)
// Set the position and optional zoom level of the map. Latitude must be
// within [-85, 85].
Map.setCenter(-123.6, 47.7, 9);
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\u003cp\u003eCenters the map view to specified coordinates and an optional zoom level.\u003c/p\u003e\n"],["\u003cp\u003eTakes longitude, latitude, and an optional zoom level (0-24) as input.\u003c/p\u003e\n"],["\u003cp\u003eReturns the \u003ccode\u003eui.Map\u003c/code\u003e object for method chaining.\u003c/p\u003e\n"],["\u003cp\u003eLatitude values must be within the range of -85 to 85.\u003c/p\u003e\n"]]],[],null,["# Map.setCenter\n\n\u003cbr /\u003e\n\nCenters the map view at a given coordinates with the given zoom level.\n\n\u003cbr /\u003e\n\nReturns the map.\n\n| Usage | Returns |\n|-------------------------------------|---------|\n| `Map.setCenter(lon, lat, `*zoom*`)` | ui.Map |\n\n| Argument | Type | Details |\n|----------|------------------|------------------------------------------|\n| `lon` | Number | The longitude of the center, in degrees. |\n| `lat` | Number | The latitude of the center, in degrees. |\n| `zoom` | Number, optional | The zoom level, from 0 to 24. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// Set the position and optional zoom level of the map. Latitude must be\n// within [-85, 85].\nMap.setCenter(-123.6, 47.7, 9);\n```"]]