ee.Geometry.Rectangle.buffer

แสดงผลอินพุตที่บัฟเฟอร์ตามระยะทางที่กำหนด หากระยะทางเป็นบวก ระบบจะขยายเรขาคณิต และหากระยะทางเป็นลบ ระบบจะย่อเรขาคณิต

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

ตัวอย่าง

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

// Define a Rectangle object.
var rectangle = ee.Geometry.Rectangle(-122.09, 37.42, -122.08, 37.43);

// Apply the buffer method to the Rectangle object.
var rectangleBuffer = rectangle.buffer({'distance': 100});

// Print the result to the console.
print('rectangle.buffer(...) =', rectangleBuffer);

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

การตั้งค่า Python

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

import ee
import geemap.core as geemap

Colab (Python)

# Define a Rectangle object.
rectangle = ee.Geometry.Rectangle(-122.09, 37.42, -122.08, 37.43)

# Apply the buffer method to the Rectangle object.
rectangle_buffer = rectangle.buffer(distance=100)

# Print the result.
display('rectangle.buffer(...) =', rectangle_buffer)

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