Lớp phủ là các đối tượng trên bản đồ được liên kết với tọa độ vĩ độ/kinh độ, vì vậy, các đối tượng này sẽ di chuyển khi bạn kéo hoặc phóng to bản đồ. Nếu muốn đặt hình ảnh trên bản đồ, bạn có thể sử dụng đối tượng GroundOverlay.
Để biết thông tin về các loại lớp phủ khác, hãy xem phần Vẽ trên bản đồ.
Thêm lớp phủ mặt đất
Hàm khởi tạo cho GroundOverlay chỉ định URL của hình ảnh và LatLngBounds của hình ảnh dưới dạng tham số. Hình ảnh sẽ được kết xuất trên bản đồ, bị ràng buộc trong các giới hạn đã cho và tuân theo phép chiếu của bản đồ.
Để xoá lớp phủ khỏi bản đồ, hãy gọi phương thức setMap() của lớp phủ, truyền null. Xin lưu ý rằng việc gọi phương thức này sẽ không xoá lớp phủ. Thao tác này sẽ xoá lớp phủ khỏi bản đồ. Nếu muốn xoá lớp phủ, bạn nên xoá lớp phủ đó khỏi bản đồ, sau đó đặt lớp phủ thành null.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-03-20 UTC."],[[["Ground overlays let you place images on a map tied to latitude/longitude coordinates."],["You can add a ground overlay using the `GroundOverlay` object, specifying the image URL and boundaries."],["To remove a ground overlay from the map, call `setMap(null)` on the overlay object."],["Removing an overlay from the map doesn't delete it; to delete it, set the overlay object to `null` after removing it from the map."]]],["Ground overlays, images tied to latitude/longitude coordinates, are added to a map using the `GroundOverlay` constructor, specifying an image URL and `LatLngBounds`. The `setMap()` method then renders the image. Removing an overlay involves calling `setMap(null)` on the overlay object, which detaches it from the map but doesn't delete it. To delete the overlay it needs to be set to null. Example code is provided in TypeScript and JavaScript.\n"]]