ee.Geometry.Polygon.convexHull

แสดงผลฮัลล์นูนของเรขาคณิตที่ระบุ ฮัลล์นูนของจุดเดียวคือจุดนั้นเอง ฮัลล์นูนของจุดที่อยู่บนเส้นตรงเดียวกันคือเส้นตรง และฮัลล์นูนของทุกอย่างที่เหลือคือรูปหลายเหลี่ยม โปรดทราบว่ารูปหลายเหลี่ยมที่เสื่อมสภาพซึ่งมีจุดยอดทั้งหมดอยู่บนเส้นเดียวกันจะส่งผลให้เกิดส่วนของเส้น

การใช้งานการคืนสินค้า
Polygon.convexHull(maxError, proj)เรขาคณิต
อาร์กิวเมนต์ประเภทรายละเอียด
ดังนี้ geometryเรขาคณิตคำนวณฮัลล์นูนของเรขาคณิตนี้
maxErrorErrorMargin, ค่าเริ่มต้น: nullปริมาณข้อผิดพลาดสูงสุดที่ยอมรับได้เมื่อทำการฉายซ้ำที่จำเป็น
projการฉายภาพ ค่าเริ่มต้น: nullการฉายภาพที่จะใช้ดำเนินการ หากไม่ได้ระบุ ระบบจะดำเนินการในระบบพิกัดทรงกลม และระยะทางเชิงเส้นจะเป็นหน่วยเมตรบนทรงกลม

ตัวอย่าง

โปรแกรมแก้ไขโค้ด (JavaScript)

// Define a Polygon object.
var polygon = ee.Geometry.Polygon(
    [[[-122.092, 37.424],
      [-122.086, 37.418],
      [-122.079, 37.425],
      [-122.085, 37.423]]]);

// Apply the convexHull method to the Polygon object.
var polygonConvexHull = polygon.convexHull({'maxError': 1});

// Print the result to the console.
print('polygon.convexHull(...) =', polygonConvexHull);

// Display relevant geometries on the map.
Map.setCenter(-122.085, 37.422, 15);
Map.addLayer(polygon,
             {'color': 'black'},
             'Geometry [black]: polygon');
Map.addLayer(polygonConvexHull,
             {'color': 'red'},
             'Result [red]: polygon.convexHull');

การตั้งค่า Python

ดูข้อมูลเกี่ยวกับ Python API และการใช้ geemap เพื่อการพัฒนาแบบอินเทอร์แอกทีฟได้ที่หน้า สภาพแวดล้อม Python

import ee
import geemap.core as geemap

Colab (Python)

# Define a Polygon object.
polygon = ee.Geometry.Polygon([[
    [-122.092, 37.424],
    [-122.086, 37.418],
    [-122.079, 37.425],
    [-122.085, 37.423],
]])

# Apply the convexHull method to the Polygon object.
polygon_convex_hull = polygon.convexHull(maxError=1)

# Print the result.
display('polygon.convexHull(...) =', polygon_convex_hull)

# Display relevant geometries on the map.
m = geemap.Map()
m.set_center(-122.085, 37.422, 15)
m.add_layer(polygon, {'color': 'black'}, 'Geometry [black]: polygon')
m.add_layer(
    polygon_convex_hull, {'color': 'red'}, 'Result [red]: polygon.convexHull'
)
m