ফিচার সম্পর্কে এক নজরে

Earth Engine-এ Feature-কে GeoJSON ফিচার হিসেবে সংজ্ঞায়িত করা হয়। নির্দিষ্টভাবে, Feature হল এমন একটি অবজেক্ট যার geometry প্রপার্টিতে Geometry অবজেক্ট (বা null) এবং properties প্রপার্টিতে অন্যান্য প্রপার্টির ডিকশনারি স্টোর করা থাকে।

ফিচার অবজেক্ট তৈরি করুন

Feature তৈরি করতে, কনস্ট্রাক্টরকে Geometry এবং (ঐচ্ছিক) অন্যান্য প্রপার্টির ডিকশনারি প্রদান করুন। যেমন:

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

// Create an ee.Geometry.
var polygon = ee.Geometry.Polygon([
  [[-35, -10], [35, -10], [35, 10], [-35, 10], [-35, -10]]
]);

// Create a Feature from the Geometry.
var polyFeature = ee.Feature(polygon, {foo: 42, bar: 'tart'});

Python সেট-আপ

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

import ee
import geemap.core as geemap

Colab (Python)

# Create an ee.Geometry.
polygon = ee.Geometry.Polygon(
    [[[-35, -10], [35, -10], [35, 10], [-35, 10], [-35, -10]]]
)

# Create a Feature from the Geometry.
poly_feature = ee.Feature(polygon, {'foo': 42, 'bar': 'tart'})

Geometry-এর মতো, Feature প্রিন্ট করা বা ম্যাপে যোগ করা হতে পারে যাতে সেটি পরীক্ষা করে দেখা ও ভিজ্যুয়ালাইজ করা যায়:

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

print(polyFeature);
Map.addLayer(polyFeature, {}, 'feature');

Python সেট-আপ

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

import ee
import geemap.core as geemap

Colab (Python)

display(poly_feature)
m = geemap.Map()
m.add_layer(poly_feature, {}, 'feature')
display(m)

Feature-এর জন্য Geometry-এর প্রয়োজন নেই এবং এটি শুধু প্রপার্টির ডিকশনারি র‌্যাপ করতে পারে। যেমন:

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

// Create a dictionary of properties, some of which may be computed values.
var dict = {foo: ee.Number(8).add(88), bar: 'nihao'};

// Create a null geometry feature with the dictionary of properties.
var nowhereFeature = ee.Feature(null, dict);

Python সেট-আপ

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

import ee
import geemap.core as geemap

Colab (Python)

# Create a dictionary of properties, some of which may be computed values.
dic = {'foo': ee.Number(8).add(88), 'bar': 'nihao'}

# Create a null geometry feature with the dictionary of properties.
nowhere_feature = ee.Feature(None, dic)

এই উদাহরণে, লক্ষ্য করুন যে Feature-এ সরবরাহ করা ডিকশনারিতে একটি গণনা করা মান রয়েছে। এইভাবে ফিচার তৈরি করা Dictionary ফলাফল (যেমন, image.reduceRegion()) সহ দীর্ঘ সময় ধরে চলা কম্পিউটেশন এক্সপোর্ট করার জন্য উপযোগী। বিস্তারিত জানতে FeatureCollections এবং টেবিল ডেটা ইমপোর্ট করা অথবা এক্সপোর্ট করা সংক্রান্ত নির্দেশিকা দেখুন।

প্রতিটি Feature-এর একটি করে প্রাথমিক Geometry আছে যা geometry প্রপার্টিতে সেভ করা আছে। অন্যান্য প্রপার্টিতে অতিরিক্ত জিওমেট্রি স্টোর করা হতে পারে। ইন্টারসেকশন ও বাফারের মতো Geometry পদ্ধতিও Feature-এ উপলভ্য আছে, যাতে প্রাইমারি Geometry পাওয়া, অপারেশন প্রয়োগ করা এবং ফলাফলকে নতুন প্রাইমারি Geometry হিসেবে সেট করা সহজ হয়। ফলাফলে Feature-এর অন্যান্য সব প্রপার্টি বজায় থাকবে, যার উপর মেথড কল করা হয়েছে। এছাড়াও, Feature-এর নন-জিওমেট্রি প্রপার্টি সেট করা ও পাওয়ার পদ্ধতিও আছে। যেমন:

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

// Make a feature and set some properties.
var feature = ee.Feature(ee.Geometry.Point([-122.22599, 37.17605]))
  .set('genus', 'Sequoia').set('species', 'sempervirens');

// Get a property from the feature.
var species = feature.get('species');
print(species);

// Set a new property.
feature = feature.set('presence', 1);

// Overwrite the old properties with a new dictionary.
var newDict = {genus: 'Brachyramphus', species: 'marmoratus'};
var feature = feature.set(newDict);

// Check the result.
print(feature);

Python সেট-আপ

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

import ee
import geemap.core as geemap

Colab (Python)

# Make a feature and set some properties.
feature = (
    ee.Feature(ee.Geometry.Point([-122.22599, 37.17605]))
    .set('genus', 'Sequoia')
    .set('species', 'sempervirens')
)

# Get a property from the feature.
species = feature.get('species')
display(species)

# Set a new property.
feature = feature.set('presence', 1)

# Overwrite the old properties with a new dictionary.
new_dic = {'genus': 'Brachyramphus', 'species': 'marmoratus'}
feature = feature.set(new_dic)

# Check the result.
display(feature)

আগের উদাহরণে, লক্ষ্য করুন যে প্রপার্টি হয় কী-ভ্যালু পেয়ার, অথবা ডিকশনারির মাধ্যমে সেট করা যেতে পারে। এছাড়াও মনে রাখবেন যে feature.set() আগে থেকে থাকা প্রপার্টি ওভাররাইট করে।