ee.Geometry.LinearRing.cutLines
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
แปลงเรขาคณิต LineString, MultiLineString และ LinearRing เป็น MultiLineString โดยการตัดเป็นส่วนๆ ที่มีความยาวไม่เกินระยะทางที่กำหนด ระบบจะแปลงรูปทรงเรขาคณิตประเภทอื่นๆ ทั้งหมดเป็น MultiLineString ว่าง
การใช้งาน | การคืนสินค้า |
---|
LinearRing.cutLines(distances, maxError, proj) | เรขาคณิต |
อาร์กิวเมนต์ | ประเภท | รายละเอียด |
---|
ดังนี้ geometry | เรขาคณิต | ตัดเส้นของรูปเรขาคณิตนี้ |
distances | รายการ | ระยะทางตาม LineString แต่ละรายการเพื่อตัดเส้นออกเป็นชิ้นๆ โดยวัดเป็นหน่วยของ proj ที่ระบุ หรือเป็นเมตรหากไม่ได้ระบุ proj |
maxError | ErrorMargin, ค่าเริ่มต้น: null | ปริมาณข้อผิดพลาดสูงสุดที่ยอมรับได้เมื่อทำการฉายซ้ำที่จำเป็น |
proj | การฉายภาพ ค่าเริ่มต้น: null | การฉายภาพผลลัพธ์และการวัดระยะทาง หรือ EPSG:4326 หากไม่ได้ระบุ |
ตัวอย่าง
โปรแกรมแก้ไขโค้ด (JavaScript)
// Define a LinearRing object.
var linearRing = ee.Geometry.LinearRing(
[[-122.091, 37.420],
[-122.085, 37.422],
[-122.080, 37.430]]);
// Apply the cutLines method to the LinearRing object.
var linearRingCutLines = linearRing.cutLines({'distances': [10, 100], 'maxError': 1});
// Print the result to the console.
print('linearRing.cutLines(...) =', linearRingCutLines);
// Display relevant geometries on the map.
Map.setCenter(-122.085, 37.422, 15);
Map.addLayer(linearRing,
{'color': 'black'},
'Geometry [black]: linearRing');
Map.addLayer(linearRingCutLines,
{'color': 'red'},
'Result [red]: linearRing.cutLines');
การตั้งค่า Python
ดูข้อมูลเกี่ยวกับ Python API และการใช้ geemap
เพื่อการพัฒนาแบบอินเทอร์แอกทีฟได้ที่หน้า
สภาพแวดล้อม Python
import ee
import geemap.core as geemap
Colab (Python)
# Define a LinearRing object.
linearring = ee.Geometry.LinearRing(
[[-122.091, 37.420], [-122.085, 37.422], [-122.080, 37.430]]
)
# Apply the cutLines method to the LinearRing object.
linearring_cut_lines = linearring.cutLines(distances=[10, 100], maxError=1)
# Print the result.
display('linearring.cutLines(...) =', linearring_cut_lines)
# Display relevant geometries on the map.
m = geemap.Map()
m.set_center(-122.085, 37.422, 15)
m.add_layer(linearring, {'color': 'black'}, 'Geometry [black]: linearring')
m.add_layer(
linearring_cut_lines, {'color': 'red'}, 'Result [red]: linearring.cutLines'
)
m
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[],["The `cutLines` method converts LineString, MultiLineString, and LinearRing geometries into a MultiLineString by dividing them into segments based on specified distances. It takes a list of `distances` to define cut points along each line, a `maxError` for reprojection tolerance, and an optional `proj` for projection information. Other geometry types are converted to an empty MultiLineString. The resulting geometry is displayed on a map with a specific color.\n"],null,[]]