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())