ee.Image.sampleRegions

একটি চিত্রের প্রতিটি পিক্সেলকে রূপান্তর করে (একটি প্রদত্ত স্কেলে) যা এক বা একাধিক অঞ্চলকে একটি বৈশিষ্ট্যে ছেদ করে, তাদের একটি বৈশিষ্ট্য সংগ্রহ হিসাবে ফিরিয়ে দেয়৷ প্রতিটি আউটপুট বৈশিষ্ট্যে ইনপুট চিত্রের প্রতি ব্যান্ডে একটি বৈশিষ্ট্য থাকবে, সেইসাথে ইনপুট বৈশিষ্ট্য থেকে অনুলিপি করা কোনো নির্দিষ্ট বৈশিষ্ট্য থাকবে।

মনে রাখবেন যে জ্যামিতিগুলি পিক্সেল কেন্দ্রগুলিতে স্ন্যাপ করা হবে৷

ব্যবহার রিটার্নস
Image. sampleRegions (collection, properties , scale , projection , tileScale , geometries ) ফিচার কালেকশন
যুক্তি টাইপ বিস্তারিত
এই: image ছবি নমুনা ইমেজ.
collection ফিচার কালেকশন যে অঞ্চলগুলি নমুনা দিতে হবে।
properties তালিকা, ডিফল্ট: নাল প্রতিটি ইনপুট বৈশিষ্ট্য থেকে অনুলিপি করার বৈশিষ্ট্যগুলির তালিকা৷ সমস্ত নন-সিস্টেম বৈশিষ্ট্যে ডিফল্ট।
scale ফ্লোট, ডিফল্ট: নাল নমুনা দেওয়ার জন্য প্রজেকশনের মিটারে একটি নামমাত্র স্কেল। অনির্দিষ্ট থাকলে, ছবির প্রথম ব্যান্ডের স্কেল ব্যবহার করা হয়।
projection অভিক্ষেপ, ডিফল্ট: নাল নমুনা যা অভিক্ষেপ. অনির্দিষ্ট হলে, ছবির প্রথম ব্যান্ডের অভিক্ষেপ ব্যবহার করা হয়। স্কেল ছাড়াও নির্দিষ্ট করা হলে, নির্দিষ্ট স্কেলে রিস্কেল করা হয়।
tileScale ফ্লোট, ডিফল্ট: 1 অ্যাগ্রিগেশন টাইলের আকার কমাতে ব্যবহৃত একটি স্কেলিং ফ্যাক্টর; একটি বৃহত্তর টাইলস্কেল ব্যবহার করে (যেমন, 2 বা 4) ডিফল্ট সহ মেমরি ফুরিয়ে যাওয়া গণনা সক্ষম করতে পারে।
geometries বুলিয়ান, ডিফল্ট: মিথ্যা সত্য হলে, ফলাফলে নমুনাযুক্ত পিক্সেল প্রতি একটি বিন্দু জ্যামিতি অন্তর্ভুক্ত হবে। অন্যথায়, জ্যামিতি বাদ দেওয়া হবে (মেমরি সংরক্ষণ)।

উদাহরণ

কোড এডিটর (জাভাস্ক্রিপ্ট)

// A Sentinel-2 surface reflectance image.
var img = ee.Image('COPERNICUS/S2_SR/20210109T185751_20210109T185931_T10SEG');
Map.setCenter(-122.503881, 37.765588, 18);
Map.addLayer(img, {bands: ['B11', 'B8', 'B3'], min: 100, max: 4500}, 'img');

// A feature collection with two polygon regions each intersecting 36
// pixels at 10 m scale.
var fcPolygon = ee.FeatureCollection([
  ee.Feature(ee.Geometry.Rectangle(
    -122.50620929, 37.76502806, -122.50552264, 37.76556663), {id: 0}),
  ee.Feature(ee.Geometry.Rectangle(
    -122.50530270, 37.76565568, -122.50460533, 37.76619425), {id: 1})
]);
Map.addLayer(fcPolygon, {color: 'yellow'}, 'fcPolygon');

var fcPolygonSamp = img.sampleRegions({
  collection: fcPolygon,
  scale: 10,
  geometries: true
});
// Note that 7 pixels are missing from the sample. If a pixel contains a masked
// band value it will be excluded from the sample. In this case, the TCI_B band
// is masked for each unsampled pixel.
print('A feature per pixel (at given scale) in each region', fcPolygonSamp);
Map.addLayer(fcPolygonSamp, {color: 'purple'}, 'fcPolygonSamp');

// A feature collection with two points intersecting two different pixels.
// This example is included to show the behavior for point geometries. In
// practice, if the feature collection is all points, ee.Image.reduceRegions
// should be used instead to save memory.
var fcPoint = ee.FeatureCollection([
  ee.Feature(ee.Geometry.Point([-122.50309256, 37.76605006]), {id: 0}),
  ee.Feature(ee.Geometry.Point([-122.50344661, 37.76560903]), {id: 1})
]);
Map.addLayer(fcPoint, {color: 'cyan'}, 'fcPoint');

var fcPointSamp = img.sampleRegions({
  collection: fcPoint,
  scale: 10
});
print('A feature per point', fcPointSamp);

পাইথন সেটআপ

পাইথন এপিআই এবং ইন্টারেক্টিভ ডেভেলপমেন্টের জন্য geemap ব্যবহার করার জন্য পাইথন এনভায়রনমেন্ট পৃষ্ঠাটি দেখুন।

import ee
import geemap.core as geemap

Colab (পাইথন)

# A Sentinel-2 surface reflectance image.
img = ee.Image('COPERNICUS/S2_SR/20210109T185751_20210109T185931_T10SEG')
m = geemap.Map()
m.set_center(-122.503881, 37.765588, 18)
m.add_layer(
    img, {'bands': ['B11', 'B8', 'B3'], 'min': 100, 'max': 4500}, 'img'
)
display(m)

# A feature collection with two polygon regions each intersecting 36
# pixels at 10 m scale.
fc_polygon = ee.FeatureCollection([
    ee.Feature(
        ee.Geometry.Rectangle(
            -122.50620929, 37.76502806, -122.50552264, 37.76556663
        ),
        {'id': 0},
    ),
    ee.Feature(
        ee.Geometry.Rectangle(
            -122.50530270, 37.76565568, -122.50460533, 37.76619425
        ),
        {'id': 1},
    ),
])
m.add_layer(fc_polygon, {'color': 'yellow'}, 'fc_polygon')

fc_polygon_samp = img.sampleRegions(
    collection=fc_polygon, scale=10, geometries=True
)
# Note that 7 pixels are missing from the sample. If a pixel contains a masked
# band value it will be excluded from the sample. In this case, the TCI_B band
# is masked for each unsampled pixel.
display('A feature per pixel (at given scale) in each region', fc_polygon_samp)
m.add_layer(fc_polygon_samp, {'color': 'purple'}, 'fc_polygon_samp')

# A feature collection with two points intersecting two different pixels.
# This example is included to show the behavior for point geometries. In
# practice, if the feature collection is all points, ee.Image.reduceRegions
# should be used instead to save memory.
fc_point = ee.FeatureCollection([
    ee.Feature(ee.Geometry.Point([-122.50309256, 37.76605006]), {'id': 0}),
    ee.Feature(ee.Geometry.Point([-122.50344661, 37.76560903]), {'id': 1}),
])
m.add_layer(fc_point, {'color': 'cyan'}, 'fc_point')

fc_point_samp = img.sampleRegions(collection=fc_point, scale=10)
display('A feature per point', fc_point_samp)
,একটি চিত্রের প্রতিটি পিক্সেলকে রূপান্তর করে (একটি প্রদত্ত স্কেলে) যা এক বা একাধিক অঞ্চলকে একটি বৈশিষ্ট্যে ছেদ করে, তাদের একটি বৈশিষ্ট্য সংগ্রহ হিসাবে ফিরিয়ে দেয়৷ প্রতিটি আউটপুট বৈশিষ্ট্যে ইনপুট চিত্রের প্রতি ব্যান্ডে একটি বৈশিষ্ট্য থাকবে, সেইসাথে ইনপুট বৈশিষ্ট্য থেকে অনুলিপি করা কোনো নির্দিষ্ট বৈশিষ্ট্য থাকবে।

মনে রাখবেন যে জ্যামিতিগুলি পিক্সেল কেন্দ্রগুলিতে স্ন্যাপ করা হবে৷

ব্যবহার রিটার্নস
Image. sampleRegions (collection, properties , scale , projection , tileScale , geometries ) ফিচার কালেকশন
যুক্তি টাইপ বিস্তারিত
এই: image ছবি নমুনা ইমেজ.
collection ফিচার কালেকশন যে অঞ্চলগুলি নমুনা দিতে হবে।
properties তালিকা, ডিফল্ট: নাল প্রতিটি ইনপুট বৈশিষ্ট্য থেকে অনুলিপি করার বৈশিষ্ট্যগুলির তালিকা৷ সমস্ত নন-সিস্টেম বৈশিষ্ট্যে ডিফল্ট।
scale ফ্লোট, ডিফল্ট: নাল নমুনা দেওয়ার জন্য প্রজেকশনের মিটারে একটি নামমাত্র স্কেল। অনির্দিষ্ট থাকলে, ছবির প্রথম ব্যান্ডের স্কেল ব্যবহার করা হয়।
projection অভিক্ষেপ, ডিফল্ট: নাল নমুনা যা অভিক্ষেপ. অনির্দিষ্ট হলে, ছবির প্রথম ব্যান্ডের অভিক্ষেপ ব্যবহার করা হয়। স্কেল ছাড়াও নির্দিষ্ট করা হলে, নির্দিষ্ট স্কেলে রিস্কেল করা হয়।
tileScale ফ্লোট, ডিফল্ট: 1 অ্যাগ্রিগেশন টাইলের আকার কমাতে ব্যবহৃত একটি স্কেলিং ফ্যাক্টর; একটি বৃহত্তর টাইলস্কেল ব্যবহার করে (যেমন, 2 বা 4) ডিফল্ট সহ মেমরি ফুরিয়ে যাওয়া গণনা সক্ষম করতে পারে।
geometries বুলিয়ান, ডিফল্ট: মিথ্যা সত্য হলে, ফলাফলে নমুনাযুক্ত পিক্সেল প্রতি একটি বিন্দু জ্যামিতি অন্তর্ভুক্ত হবে। অন্যথায়, জ্যামিতি বাদ দেওয়া হবে (মেমরি সংরক্ষণ)।

উদাহরণ

কোড এডিটর (জাভাস্ক্রিপ্ট)

// A Sentinel-2 surface reflectance image.
var img = ee.Image('COPERNICUS/S2_SR/20210109T185751_20210109T185931_T10SEG');
Map.setCenter(-122.503881, 37.765588, 18);
Map.addLayer(img, {bands: ['B11', 'B8', 'B3'], min: 100, max: 4500}, 'img');

// A feature collection with two polygon regions each intersecting 36
// pixels at 10 m scale.
var fcPolygon = ee.FeatureCollection([
  ee.Feature(ee.Geometry.Rectangle(
    -122.50620929, 37.76502806, -122.50552264, 37.76556663), {id: 0}),
  ee.Feature(ee.Geometry.Rectangle(
    -122.50530270, 37.76565568, -122.50460533, 37.76619425), {id: 1})
]);
Map.addLayer(fcPolygon, {color: 'yellow'}, 'fcPolygon');

var fcPolygonSamp = img.sampleRegions({
  collection: fcPolygon,
  scale: 10,
  geometries: true
});
// Note that 7 pixels are missing from the sample. If a pixel contains a masked
// band value it will be excluded from the sample. In this case, the TCI_B band
// is masked for each unsampled pixel.
print('A feature per pixel (at given scale) in each region', fcPolygonSamp);
Map.addLayer(fcPolygonSamp, {color: 'purple'}, 'fcPolygonSamp');

// A feature collection with two points intersecting two different pixels.
// This example is included to show the behavior for point geometries. In
// practice, if the feature collection is all points, ee.Image.reduceRegions
// should be used instead to save memory.
var fcPoint = ee.FeatureCollection([
  ee.Feature(ee.Geometry.Point([-122.50309256, 37.76605006]), {id: 0}),
  ee.Feature(ee.Geometry.Point([-122.50344661, 37.76560903]), {id: 1})
]);
Map.addLayer(fcPoint, {color: 'cyan'}, 'fcPoint');

var fcPointSamp = img.sampleRegions({
  collection: fcPoint,
  scale: 10
});
print('A feature per point', fcPointSamp);

পাইথন সেটআপ

পাইথন এপিআই এবং ইন্টারেক্টিভ ডেভেলপমেন্টের জন্য geemap ব্যবহার করার জন্য পাইথন এনভায়রনমেন্ট পৃষ্ঠাটি দেখুন।

import ee
import geemap.core as geemap

Colab (পাইথন)

# A Sentinel-2 surface reflectance image.
img = ee.Image('COPERNICUS/S2_SR/20210109T185751_20210109T185931_T10SEG')
m = geemap.Map()
m.set_center(-122.503881, 37.765588, 18)
m.add_layer(
    img, {'bands': ['B11', 'B8', 'B3'], 'min': 100, 'max': 4500}, 'img'
)
display(m)

# A feature collection with two polygon regions each intersecting 36
# pixels at 10 m scale.
fc_polygon = ee.FeatureCollection([
    ee.Feature(
        ee.Geometry.Rectangle(
            -122.50620929, 37.76502806, -122.50552264, 37.76556663
        ),
        {'id': 0},
    ),
    ee.Feature(
        ee.Geometry.Rectangle(
            -122.50530270, 37.76565568, -122.50460533, 37.76619425
        ),
        {'id': 1},
    ),
])
m.add_layer(fc_polygon, {'color': 'yellow'}, 'fc_polygon')

fc_polygon_samp = img.sampleRegions(
    collection=fc_polygon, scale=10, geometries=True
)
# Note that 7 pixels are missing from the sample. If a pixel contains a masked
# band value it will be excluded from the sample. In this case, the TCI_B band
# is masked for each unsampled pixel.
display('A feature per pixel (at given scale) in each region', fc_polygon_samp)
m.add_layer(fc_polygon_samp, {'color': 'purple'}, 'fc_polygon_samp')

# A feature collection with two points intersecting two different pixels.
# This example is included to show the behavior for point geometries. In
# practice, if the feature collection is all points, ee.Image.reduceRegions
# should be used instead to save memory.
fc_point = ee.FeatureCollection([
    ee.Feature(ee.Geometry.Point([-122.50309256, 37.76605006]), {'id': 0}),
    ee.Feature(ee.Geometry.Point([-122.50344661, 37.76560903]), {'id': 1}),
])
m.add_layer(fc_point, {'color': 'cyan'}, 'fc_point')

fc_point_samp = img.sampleRegions(collection=fc_point, scale=10)
display('A feature per point', fc_point_samp)