ประกาศ : โปรเจ็กต์ที่ไม่ใช่เชิงพาณิชย์ทั้งหมดที่ลงทะเบียนเพื่อใช้ Earth Engine ก่อนวันที่
15 เมษายน 2025 ต้อง
ยืนยันการมีสิทธิ์ที่ไม่ใช่เชิงพาณิชย์ เพื่อรักษาสิทธิ์เข้าถึง หากคุณไม่ยืนยันภายในวันที่ 26 กันยายน 2025 ระบบอาจระงับสิทธิ์เข้าถึงของคุณ
ส่งความคิดเห็น
ee.Geometry.MultiLineString.cutLines
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
แปลงเรขาคณิต LineString, MultiLineString และ LinearRing เป็น MultiLineString โดยการตัดเป็นส่วนๆ ที่มีความยาวไม่เกินระยะทางที่กำหนด ระบบจะแปลงรูปทรงเรขาคณิตประเภทอื่นๆ ทั้งหมดเป็น MultiLineString ว่าง
การใช้งาน การคืนสินค้า MultiLineString. cutLines (distances, maxError , proj )
เรขาคณิต
อาร์กิวเมนต์ ประเภท รายละเอียด ดังนี้ geometry
เรขาคณิต ตัดเส้นของรูปเรขาคณิตนี้ distances
รายการ ระยะทางตาม LineString แต่ละรายการเพื่อตัดเส้นออกเป็นชิ้นๆ โดยวัดเป็นหน่วยของ proj ที่ระบุ หรือเป็นเมตรหากไม่ได้ระบุ proj maxError
ErrorMargin, ค่าเริ่มต้น: null ปริมาณข้อผิดพลาดสูงสุดที่ยอมรับได้เมื่อทำการฉายซ้ำที่จำเป็น proj
การฉายภาพ ค่าเริ่มต้น: null การฉายภาพผลลัพธ์และการวัดระยะทาง หรือ EPSG:4326 หากไม่ได้ระบุ
ตัวอย่าง
โปรแกรมแก้ไขโค้ด (JavaScript)
// Define a MultiLineString object.
var multiLineString = ee . Geometry . MultiLineString (
[[[ - 122.088 , 37.418 ], [ - 122.086 , 37.422 ], [ - 122.082 , 37.418 ]],
[[ - 122.087 , 37.416 ], [ - 122.083 , 37.416 ], [ - 122.082 , 37.419 ]]]);
// Apply the cutLines method to the MultiLineString object.
var multiLineStringCutLines = multiLineString . cutLines ({ 'distances' : [ 10 , 100 ], 'maxError' : 1 });
// Print the result to the console.
print ( 'multiLineString.cutLines(...) =' , multiLineStringCutLines );
// Display relevant geometries on the map.
Map . setCenter ( - 122.085 , 37.422 , 15 );
Map . addLayer ( multiLineString ,
{ 'color' : 'black' },
'Geometry [black]: multiLineString' );
Map . addLayer ( multiLineStringCutLines ,
{ 'color' : 'red' },
'Result [red]: multiLineString.cutLines' );
การตั้งค่า Python
ดูข้อมูลเกี่ยวกับ Python API และการใช้ geemap
เพื่อการพัฒนาแบบอินเทอร์แอกทีฟได้ที่หน้า
สภาพแวดล้อม Python
import ee
import geemap.core as geemap
Colab (Python)
# Define a MultiLineString object.
multilinestring = ee . Geometry . MultiLineString ([
[[ - 122.088 , 37.418 ], [ - 122.086 , 37.422 ], [ - 122.082 , 37.418 ]],
[[ - 122.087 , 37.416 ], [ - 122.083 , 37.416 ], [ - 122.082 , 37.419 ]],
])
# Apply the cutLines method to the MultiLineString object.
multilinestring_cut_lines = multilinestring . cutLines (
distances = [ 10 , 100 ], maxError = 1
)
# Print the result.
display ( 'multilinestring.cutLines(...) =' , multilinestring_cut_lines )
# Display relevant geometries on the map.
m = geemap . Map ()
m . set_center ( - 122.085 , 37.422 , 15 )
m . add_layer (
multilinestring , { 'color' : 'black' }, 'Geometry [black]: multilinestring'
)
m . add_layer (
multilinestring_cut_lines ,
{ 'color' : 'red' },
'Result [red]: multilinestring.cutLines' ,
)
m
ส่งความคิดเห็น
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
หากต้องการบอกให้เราทราบเพิ่มเติม
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 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, measured in units of the given `proj` or meters by default. It has a `maxError` parameter that sets a tolerance for reprojection error. Other geometry types will return an empty MultiLineString. The outputs are shown with JavaScript and Python code.\n"]]