Earth Engine ขอแนะนำ
ระดับโควต้าที่ไม่ใช่เชิงพาณิชย์ เพื่อปกป้องทรัพยากรการประมวลผลที่ใช้ร่วมกันและรับประกันประสิทธิภาพที่เชื่อถือได้สำหรับทุกคน โปรเจ็กต์ที่ไม่ใช่เชิงพาณิชย์ทั้งหมดจะต้องเลือกระดับโควต้าภายในวันที่
27 เมษายน 2026 หรือจะใช้ระดับชุมชนโดยค่าเริ่มต้นก็ได้ โควต้าระดับจะมีผลกับโปรเจ็กต์ทั้งหมด (ไม่ว่าวันที่เลือกระดับจะเป็นวันใด) ในวันที่
27 เมษายน 2026 ดูข้อมูลเพิ่มเติม
Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
ส่งความคิดเห็น
ee.FeatureCollection.randomColumn
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เพิ่มคอลัมน์ของตัวเลขแบบสุ่มจำลองที่แน่นอนลงในคอลเล็กชัน ผลลัพธ์คือจำนวนจุดลอยตัวแบบละเอียด เมื่อใช้การแจกแจงแบบ "สม่ำเสมอ" (ค่าเริ่มต้น) เอาต์พุตจะอยู่ในช่วง [0, 1) เมื่อใช้การแจกแจงแบบ "ปกติ" เอาต์พุตจะมีค่า μ=0, σ=1 แต่ไม่มีขีดจำกัดที่ชัดเจน
การใช้งาน การคืนสินค้า FeatureCollection. randomColumn (columnName , seed , distribution , rowKeys )FeatureCollection
อาร์กิวเมนต์ ประเภท รายละเอียด this: collection FeatureCollection คอลเล็กชันอินพุตที่จะเพิ่มคอลัมน์แบบสุ่ม columnNameสตริง โดยค่าเริ่มต้นคือ "random" ชื่อของคอลัมน์ที่จะเพิ่ม seedตัวเลขยาว ค่าเริ่มต้น: 0 เมล็ดที่ใช้เมื่อสร้างตัวเลขสุ่ม distributionสตริง โดยค่าเริ่มต้นคือ "uniform" ประเภทการแจกแจงของตัวเลขสุ่มที่จะสร้าง ซึ่งอาจเป็น "แบบสม่ำเสมอ" หรือ "แบบปกติ" rowKeysรายการ (ไม่บังคับ) รายการพร็อพเพอร์ตี้ที่ควรระบุองค์ประกอบของคอลเล็กชันโดยไม่ซ้ำกันและใช้ซ้ำได้ ซึ่งจะใช้สร้างเลขสุ่ม ค่าเริ่มต้นคือ [system:index]
ตัวอย่าง
เครื่องมือแก้ไขโค้ด (JavaScript)
// FeatureCollection of power plants in Belgium.
var fc = ee . FeatureCollection ( 'WRI/GPPD/power_plants' )
. filter ( 'country_lg == "Belgium"' );
print ( 'N features in collection' , fc . size ());
// Add a uniform distribution random value column to the FeatureCollection.
fc = fc . randomColumn ();
// Randomly split the collection into two sets, 30% and 70% of the total.
var randomSample30 = fc . filter ( 'random < 0.3' );
print ( 'N features in 30% sample' , randomSample30 . size ());
var randomSample70 = fc . filter ( 'random >= 0.3' );
print ( 'N features in 70% sample' , randomSample70 . size ());
การตั้งค่า Python
ดูข้อมูลเกี่ยวกับ Python API และการใช้ geemap สําหรับการพัฒนาแบบอินเทอร์แอกทีฟได้ที่หน้า
สภาพแวดล้อม Python
import ee
import geemap.core as geemap
Colab (Python)
# FeatureCollection of power plants in Belgium.
fc = ee . FeatureCollection ( 'WRI/GPPD/power_plants' ) . filter (
'country_lg == "Belgium"' )
display ( 'N features in collection:' , fc . size ())
# Add a uniform distribution random value column to the FeatureCollection.
fc = fc . randomColumn ()
# Randomly split the collection into two sets, 30% and 70% of the total.
random_sample_30 = fc . filter ( 'random < 0.3' )
display ( 'N features in 30 % s ample:' , random_sample_30 . size ())
random_sample_70 = fc . filter ( 'random >= 0.3' )
display ( 'N features in 70 % s ample:' , random_sample_70 . size ())
ส่งความคิดเห็น
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-10-30 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-10-30 UTC"],[],["This tool adds a column of pseudorandom numbers to a FeatureCollection. Users can specify the `columnName`, `seed`, and `distribution`. The default distribution, 'uniform', generates numbers between 0 and 1; 'normal' produces numbers with a mean of 0 and a standard deviation of 1. The `randomColumn` method returns the modified FeatureCollection. This is exemplified by creating random splits into subsets. The outputs are double-precision floating point numbers.\n"]]