ee.Geometry.LineString.perimeter

แสดงผลความยาวของเส้นรอบรูปของส่วนที่เป็นรูปหลายเหลี่ยมของเรขาคณิต เส้นรอบรูปของเรขาคณิตหลายรายการคือผลรวมของเส้นรอบรูปของคอมโพเนนต์

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

ตัวอย่าง

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

// Define a LineString object.
var lineString = ee.Geometry.LineString([[-122.09, 37.42], [-122.08, 37.43]]);

// Apply the perimeter method to the LineString object.
var lineStringPerimeter = lineString.perimeter({'maxError': 1});

// Print the result to the console.
print('lineString.perimeter(...) =', lineStringPerimeter);

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

การตั้งค่า Python

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

import ee
import geemap.core as geemap

Colab (Python)

# Define a LineString object.
linestring = ee.Geometry.LineString([[-122.09, 37.42], [-122.08, 37.43]])

# Apply the perimeter method to the LineString object.
linestring_perimeter = linestring.perimeter(maxError=1)

# Print the result.
display('linestring.perimeter(...) =', linestring_perimeter)

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