Earth Engine ขอแนะนำ
ระดับโควต้าที่ไม่ใช่เชิงพาณิชย์ เพื่อปกป้องทรัพยากรการประมวลผลที่ใช้ร่วมกันและรับประกันประสิทธิภาพที่เชื่อถือได้สำหรับทุกคน โปรเจ็กต์ที่ไม่ใช่เชิงพาณิชย์ทั้งหมดจะต้องเลือกระดับโควต้าภายในวันที่
27 เมษายน 2026 หรือจะใช้ระดับชุมชนโดยค่าเริ่มต้นก็ได้ โควต้าระดับจะมีผลกับโปรเจ็กต์ทั้งหมด (ไม่ว่าวันที่เลือกระดับจะเป็นวันใด) ในวันที่
27 เมษายน 2026 ดูข้อมูลเพิ่มเติม
Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
ส่งความคิดเห็น
ee.FeatureCollection.reduceColumns
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ใช้ตัวลดกับแต่ละองค์ประกอบของคอลเล็กชัน โดยใช้ตัวเลือกที่กำหนดเพื่อกำหนดอินพุต
แสดงผลพจนานุกรมของผลลัพธ์โดยใช้ชื่อเอาต์พุตเป็นคีย์
การใช้งาน การคืนสินค้า FeatureCollection. reduceColumns (reducer, selectors, weightSelectors )พจนานุกรม
อาร์กิวเมนต์ ประเภท รายละเอียด collectionFeatureCollection คอลเล็กชันที่จะรวบรวมข้อมูล reducerตัวลดตำแหน่ง ตัวลดที่จะใช้ selectorsรายการ ตัวเลือกสำหรับอินพุตแต่ละรายการของตัวลด weightSelectorsรายการ (ค่าเริ่มต้น: null) ตัวเลือกสำหรับอินพุตแบบถ่วงน้ำหนักแต่ละรายการของตัวลด
ตัวอย่าง
ตัวแก้ไขโค้ด (JavaScript)
// FeatureCollection of power plants in Belgium.
var fc = ee . FeatureCollection ( 'WRI/GPPD/power_plants' )
. filter ( 'country_lg == "Belgium"' );
// Calculate mean of a single FeatureCollection property.
var propMean = fc . reduceColumns ({
reducer : ee . Reducer . mean (),
selectors : [ 'gwh_estimt' ]
});
print ( 'Mean of a single property' , propMean );
// Calculate mean of multiple FeatureCollection properties.
var propsMean = fc . reduceColumns ({
reducer : ee . Reducer . mean (). repeat ( 2 ),
selectors : [ 'gwh_estimt' , 'capacitymw' ]
});
print ( 'Mean of multiple properties' , propsMean );
// Calculate weighted mean of a single FeatureCollection property. Add a fuel
// source weight property to the FeatureCollection.
var fuelWeights = ee . Dictionary ({
Wind : 0.9 ,
Gas : 0.2 ,
Oil : 0.2 ,
Coal : 0.1 ,
Hydro : 0.7 ,
Biomass : 0.5 ,
Nuclear : 0.3
});
fc = fc . map ( function ( feature ) {
return feature . set ( 'weight' , fuelWeights . getNumber ( feature . get ( 'fuel1' )));
});
var weightedMean = fc . reduceColumns ({
reducer : ee . Reducer . mean (),
selectors : [ 'gwh_estimt' ],
weightSelectors : [ 'weight' ]
});
print ( 'Weighted mean of a single property' , weightedMean );
การตั้งค่า 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"' )
# Calculate mean of a single FeatureCollection property.
prop_mean = fc . reduceColumns ( ** {
'reducer' : ee . Reducer . mean (),
'selectors' : [ 'gwh_estimt' ]
})
display ( 'Mean of a single property:' , prop_mean )
# Calculate mean of multiple FeatureCollection properties.
props_mean = fc . reduceColumns ( ** {
'reducer' : ee . Reducer . mean () . repeat ( 2 ),
'selectors' : [ 'gwh_estimt' , 'capacitymw' ]
})
display ( 'Mean of multiple properties:' , props_mean )
# Calculate weighted mean of a single FeatureCollection property. Add a fuel
# source weight property to the FeatureCollection.
def get_fuel ( feature ):
return feature . set ( 'weight' , fuel_weights . getNumber ( feature . get ( 'fuel1' )))
fuel_weights = ee . Dictionary ({
'Wind' : 0.9 ,
'Gas' : 0.2 ,
'Oil' : 0.2 ,
'Coal' : 0.1 ,
'Hydro' : 0.7 ,
'Biomass' : 0.5 ,
'Nuclear' : 0.3
})
fc = fc . map ( get_fuel )
weighted_mean = fc . reduceColumns ( ** {
'reducer' : ee . Reducer . mean (),
'selectors' : [ 'gwh_estimt' ],
'weightSelectors' : [ 'weight' ]
})
display ( 'Weighted mean of a single property:' , weighted_mean )
ส่งความคิดเห็น
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2026-04-20 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"]],["อัปเดตล่าสุด 2026-04-20 UTC"],[],["The `reduceColumns` function applies a reducer to a FeatureCollection, generating a dictionary of results. It uses `selectors` to specify input properties and can use `weightSelectors` for weighted inputs. The function takes a `reducer`, and a list of `selectors` and `weightSelectors`. This method can calculate means of single or multiple properties and weighted means by using a reducer and specifying properties to calculate on. The results are returned as a dictionary.\n"]]