آمار مناطق تصویر,آمار مناطق تصویر

برای دریافت آمار تصویر در چندین منطقه ذخیره شده در یک FeatureCollection ، می توانید از image.reduceRegions() برای کاهش چندین ناحیه به طور همزمان استفاده کنید. ورودی reduceRegions() یک Image و یک FeatureCollection است. خروجی یکی دیگر FeatureCollection با خروجی reduceRegions() به عنوان ویژگی های هر Feature است. در این مثال، میانگین باندهای ترکیبی سالانه Landsat 7 در هر هندسه ویژگی به عنوان ویژگی به ویژگی های ورودی اضافه می شود:

ویرایشگر کد (جاوا اسکریپت)

// Load input imagery: Landsat 7 5-year composite.
var image = ee.Image('LANDSAT/LE7_TOA_5YEAR/2008_2012');

// Load a FeatureCollection of counties in Maine.
var maineCounties = ee.FeatureCollection('TIGER/2016/Counties')
  .filter(ee.Filter.eq('STATEFP', '23'));

// Add reducer output to the Features in the collection.
var maineMeansFeatures = image.reduceRegions({
  collection: maineCounties,
  reducer: ee.Reducer.mean(),
  scale: 30,
});

// Print the first feature, to illustrate the result.
print(ee.Feature(maineMeansFeatures.first()).select(image.bandNames()));

راه اندازی پایتون

برای اطلاعات در مورد Python API و استفاده از geemap برای توسعه تعاملی به صفحه محیط Python مراجعه کنید.

import ee
import geemap.core as geemap

کولب (پایتون)

# Load input imagery: Landsat 7 5-year composite.
image = ee.Image('LANDSAT/LE7_TOA_5YEAR/2008_2012')

# Load a FeatureCollection of counties in Maine.
maine_counties = ee.FeatureCollection('TIGER/2016/Counties').filter(
    ee.Filter.eq('STATEFP', '23')
)

# Add reducer output to the Features in the collection.
maine_means_features = image.reduceRegions(
    collection=maine_counties, reducer=ee.Reducer.mean(), scale=30
)

# Print the first feature, to illustrate the result.
display(ee.Feature(maine_means_features.first()).select(image.bandNames()))

توجه داشته باشید که ویژگی های جدید، با نام باند، به FeatureCollection اضافه شده است تا میانگین ترکیب در هر هندسه Feature ذخیره شود. در نتیجه، خروجی دستور چاپ باید چیزی شبیه به:

Feature (Polygon, 7 properties)
  type: Feature
  geometry: Polygon, 7864 vertices
  properties: Object (7 properties)
    B1: 24.034822192925134
    B2: 19.40202233717122
    B3: 13.568454303016292
    B4: 63.00423784301736
    B5: 29.142707062821305
    B6_VCID_2: 186.18172376827042
    B7: 12.064469664746415
    
،

برای دریافت آمار تصویر در چندین منطقه ذخیره شده در یک FeatureCollection ، می توانید از image.reduceRegions() برای کاهش چندین ناحیه به طور همزمان استفاده کنید. ورودی reduceRegions() یک Image و یک FeatureCollection است. خروجی یکی دیگر FeatureCollection با خروجی reduceRegions() به عنوان ویژگی های هر Feature است. در این مثال، میانگین باندهای ترکیبی سالانه Landsat 7 در هر هندسه ویژگی به عنوان ویژگی به ویژگی های ورودی اضافه می شود:

ویرایشگر کد (جاوا اسکریپت)

// Load input imagery: Landsat 7 5-year composite.
var image = ee.Image('LANDSAT/LE7_TOA_5YEAR/2008_2012');

// Load a FeatureCollection of counties in Maine.
var maineCounties = ee.FeatureCollection('TIGER/2016/Counties')
  .filter(ee.Filter.eq('STATEFP', '23'));

// Add reducer output to the Features in the collection.
var maineMeansFeatures = image.reduceRegions({
  collection: maineCounties,
  reducer: ee.Reducer.mean(),
  scale: 30,
});

// Print the first feature, to illustrate the result.
print(ee.Feature(maineMeansFeatures.first()).select(image.bandNames()));

راه اندازی پایتون

برای اطلاعات در مورد Python API و استفاده از geemap برای توسعه تعاملی به صفحه محیط Python مراجعه کنید.

import ee
import geemap.core as geemap

کولب (پایتون)

# Load input imagery: Landsat 7 5-year composite.
image = ee.Image('LANDSAT/LE7_TOA_5YEAR/2008_2012')

# Load a FeatureCollection of counties in Maine.
maine_counties = ee.FeatureCollection('TIGER/2016/Counties').filter(
    ee.Filter.eq('STATEFP', '23')
)

# Add reducer output to the Features in the collection.
maine_means_features = image.reduceRegions(
    collection=maine_counties, reducer=ee.Reducer.mean(), scale=30
)

# Print the first feature, to illustrate the result.
display(ee.Feature(maine_means_features.first()).select(image.bandNames()))

توجه داشته باشید که ویژگی‌های جدیدی که با نام باند کلید می‌خورند، به FeatureCollection اضافه شده‌اند تا میانگین کامپوزیت در هر هندسه Feature ذخیره شود. در نتیجه، خروجی دستور چاپ باید چیزی شبیه به:

Feature (Polygon, 7 properties)
  type: Feature
  geometry: Polygon, 7864 vertices
  properties: Object (7 properties)
    B1: 24.034822192925134
    B2: 19.40202233717122
    B3: 13.568454303016292
    B4: 63.00423784301736
    B5: 29.142707062821305
    B6_VCID_2: 186.18172376827042
    B7: 12.064469664746415