ee.FeatureCollection.map
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
یک الگوریتم را روی یک مجموعه نقشه میکشد.
مجموعه نقشهبرداری شده را برمیگرداند.
استفاده | برمی گرداند | FeatureCollection. map (algorithm, dropNulls ) | مجموعه |
استدلال | تایپ کنید | جزئیات | این: collection | مجموعه | نمونه مجموعه |
algorithm | تابع | عملیات نقشه برداری از تصاویر یا ویژگی های مجموعه. یک تابع جاوا اسکریپت که یک تصویر یا ویژگی را دریافت می کند و یکی را برمی گرداند. تابع فقط یک بار فراخوانی می شود و نتیجه به عنوان یک توصیف ثبت می شود، بنابراین نمی تواند عملیات ضروری را انجام دهد یا به حالت خارجی تکیه کند. |
dropNulls | بولی، اختیاری | اگر درست باشد، الگوریتم نگاشت شده مجاز به بازگشت تهی است و عناصری که برای آنها null برمیگرداند حذف خواهند شد. |
نمونه ها
ویرایشگر کد (جاوا اسکریپت)
// FeatureCollection of power plants in Belgium.
var fc = ee.FeatureCollection('WRI/GPPD/power_plants')
.filter('country_lg == "Belgium"');
// Function to convert power plant capacity from megawatts to gigawatts and
// add the value as a new feature property.
var mwToGw = function(feature) {
var megawatt = feature.getNumber('capacitymw');
var gigawatt = megawatt.divide(1000);
return feature.set('capacitygw', gigawatt);
};
// Apply the function to each feature in the collection.
fc = fc.map(mwToGw);
print('Note the new "capacitygw" property in each feature', fc);
راه اندازی پایتون
برای اطلاعات در مورد API پایتون و استفاده از geemap
برای توسعه تعاملی به صفحه محیط پایتون مراجعه کنید.
import ee
import geemap.core as geemap
کولب (پایتون)
# FeatureCollection of power plants in Belgium.
fc = ee.FeatureCollection('WRI/GPPD/power_plants').filter(
'country_lg == "Belgium"')
# Function to convert power plant capacity from megawatts to gigawatts and
# add the value as a new feature property.
def mw_to_gw(feature):
megawatt = feature.getNumber('capacitymw')
gigawatt = megawatt.divide(1000)
return feature.set('capacitygw', gigawatt)
# Apply the function to each feature in the collection.
fc = fc.map(mw_to_gw)
print('Note the new "capacitygw" property in each feature:', fc.getInfo())
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی."],[],["The `map` algorithm applies a user-defined function to each element within a collection (e.g., features or images). This function, which accepts an element as input and returns a modified one, is applied to each item of the collection. The `dropNulls` argument allows filtering null return values. The result is a new collection containing the modified elements. For example, converting power plant capacity units and adding them as a new property to the features.\n"]]