הודעה : כל הפרויקטים הלא מסחריים שנרשמו לשימוש ב-Earth Engine לפני
15 באפריל 2025 חייבים
לאמת את הזכאות לשימוש לא מסחרי כדי לשמור על הגישה. אם לא תאמתו את החשבון עד 26 בספטמבר 2025, יכול להיות שהגישה שלכם תושעה.
שליחת משוב
ee.FeatureCollection.reduceToImage
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
Creates an image from a feature collection by applying a reducer over the selected properties of all the features that intersect each pixel.
שימוש החזרות FeatureCollection. reduceToImage (properties, reducer)
תמונה
ארגומנט סוג פרטים זה: collection
FeatureCollection אוסף של תכונות להצטלבות עם כל פיקסל של הפלט. properties
רשימה מאפיינים לבחירה מכל תכונה ולהעברה לפונקציית ה-reducer. reducer
הפחתה פונקציית Reducer שמשלבת את המאפיינים של כל תכונה מצטלבת לתוצאה סופית לאחסון בפיקסל.
דוגמאות
עורך הקוד (JavaScript)
// FeatureCollection of power plants in Belgium.
var fc = ee . FeatureCollection ( 'WRI/GPPD/power_plants' )
. filter ( 'country_lg == "Belgium"' );
// Create an image from features; pixel values are determined from reduction of
// property values of the features intersecting each pixel.
var image = fc . reduceToImage ({
properties : [ 'gwh_estimt' ],
reducer : ee . Reducer . sum ()
});
// The goal is to sum the electricity generated in 2015 for the power plants
// intersecting 10 km cells and view the result as a map layer.
// ee.FeatureCollection.reduceToImage does not allow the image projection to be
// set because it is waiting on downstream functions that include "crs",
// "scale", and "crsTransform" parameters to define it (e.g., Export.image.*).
// Here, we'll force the projection with ee.Image.reproject so the result can be
// viewed in the map. Note that using small scales with reproject while viewing
// large regions breaks the features that make Earth Engine fast and may result
// in poor performance and/or errors.
image = image . reproject ( 'EPSG:3035' , null , 10000 );
// Display the image on the map.
Map . setCenter ( 4.3376 , 50.947 , 8 );
Map . setLocked ( true );
Map . addLayer (
image . updateMask ( image . gt ( 0 )),
{ min : 0 , max : 2000 , palette : [ 'yellow' , 'orange' , 'red' ]},
'Total estimated annual electricity generation, 2015' );
Map . addLayer ( fc , null , 'Belgian power plants' );
הגדרת Python
מידע על Python API ועל שימוש ב-geemap
לפיתוח אינטראקטיבי מופיע בדף
Python Environment .
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"'
)
# Create an image from features pixel values are determined from reduction of
# property values of the features intersecting each pixel.
image = fc . reduceToImage ( properties = [ 'gwh_estimt' ], reducer = ee . Reducer . sum ())
# The goal is to sum the electricity generated in 2015 for the power plants
# intersecting 10 km cells and view the result as a map layer.
# ee.FeatureCollection.reduceToImage does not allow the image projection to be
# set because it is waiting on downstream functions that include "crs",
# "scale", and "crsTransform" parameters to define it (e.g., Export.image.*).
# Here, we'll force the projection with ee.Image.reproject so the result can be
# viewed in the map. Note that using small scales with reproject while viewing
# large regions breaks the features that make Earth Engine fast and may result
# in poor performance and/or errors.
image = image . reproject ( 'EPSG:3035' , None , 10000 )
# Display the image on the map.
m = geemap . Map ()
m . set_center ( 4.3376 , 50.947 , 8 )
m . add_layer (
image . updateMask ( image . gt ( 0 )),
{ 'min' : 0 , 'max' : 2000 , 'palette' : [ 'yellow' , 'orange' , 'red' ]},
'Total estimated annual electricity generation, 2015' ,
)
m . add_layer ( fc , None , 'Belgian power plants' )
m
שליחת משוב
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 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)."],[],[]]