Thông báo: Tất cả dự án phi thương mại đã đăng ký sử dụng Earth Engine trước ngày 15 tháng 4 năm 2025 phải xác minh điều kiện sử dụng phi thương mại để duy trì quyền truy cập vào Earth Engine.
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Trả về một điểm ở tâm của các thành phần có kích thước cao nhất của hình học. Các thành phần có thứ nguyên thấp hơn sẽ bị bỏ qua, vì vậy, tâm của một hình học chứa 2 đa giác, 3 đường thẳng và một điểm sẽ tương đương với tâm của một hình học chỉ chứa 2 đa giác.
Cách sử dụng
Giá trị trả về
Rectangle.centroid(maxError, proj)
Hình học
Đối số
Loại
Thông tin chi tiết
this: geometry
Hình học
Tính toán trọng tâm của hình học này.
maxError
ErrorMargin, mặc định: null
Lượng lỗi tối đa được chấp nhận khi thực hiện bất kỳ phép chiếu lại cần thiết nào.
proj
Phép chiếu, mặc định: null
Nếu được chỉ định, kết quả sẽ nằm trong phép chiếu này. Nếu không, giá trị này sẽ ở EPSG:4326.
[[["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-07-26 UTC."],[[["`centroid()` returns a point representing the center of the highest dimension components within a geometry, ignoring lower dimensions."],["The function prioritizes polygons over lines or points when calculating the center."],["It accepts optional `maxError` and `proj` parameters for controlling reprojection and output projection."],["The returned point can be accessed as a Geometry object."]]],["The `centroid` method calculates the center point of a geometry's highest-dimension components, ignoring lower-dimensional ones. It accepts `maxError` to define the tolerated reprojection error and `proj` to specify the output projection; otherwise, it defaults to EPSG:4326. For example, applying `centroid` to a rectangle returns its center point. The method's result, which is a `Geometry` object, can be printed and displayed on a map, as shown in JavaScript and Python code examples.\n"]]