ঘোষণা :
15 এপ্রিল, 2025 এর আগে আর্থ ইঞ্জিন ব্যবহার করার জন্য নিবন্ধিত সমস্ত অবাণিজ্যিক প্রকল্পগুলিকে অবশ্যই আর্থ ইঞ্জিন অ্যাক্সেস বজায় রাখার জন্য
অ-বাণিজ্যিক যোগ্যতা যাচাই করতে হবে।
মতামত জানান
ee.FeatureCollection.cluster
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
একটি সংগ্রহের প্রতিটি বৈশিষ্ট্যকে ক্লাস্টার করে, প্রতিটি বৈশিষ্ট্যের সাথে একটি নতুন কলাম যোগ করে যেখানে ক্লাস্টার নম্বরটি বরাদ্দ করা হয়েছে।
ব্যবহার রিটার্নস FeatureCollection. cluster (clusterer, outputName )
ফিচার কালেকশন
যুক্তি টাইপ বিস্তারিত এই: features
ফিচার কালেকশন ক্লাস্টারে বৈশিষ্ট্যের সংগ্রহ। প্রতিটি বৈশিষ্ট্যে ক্লাস্টারের স্কিমার সমস্ত বৈশিষ্ট্য থাকতে হবে। clusterer
ক্লাস্টার ব্যবহার করার জন্য ক্লাস্টারার। outputName
স্ট্রিং, ডিফল্ট: "ক্লাস্টার" আউটপুট সম্পত্তির নাম যোগ করতে হবে।
উদাহরণ কোড এডিটর (জাভাস্ক্রিপ্ট)
// Import a Sentinel-2 surface reflectance image.
var image = ee . Image ( 'COPERNICUS/S2_SR/20210109T185751_20210109T185931_T10SEG' );
// Get the image geometry to define the geographical bounds of a point sample.
var imageBounds = image . geometry ();
// Sample the image at a set of random points; a feature collection is returned.
var pointSampleFc = image . sample (
{ region : imageBounds , scale : 20 , numPixels : 1000 , geometries : true });
// Instantiate a k-means clusterer and train it.
var clusterer = ee . Clusterer . wekaKMeans ( 5 ). train ( pointSampleFc );
// Cluster the input using the trained clusterer; optionally specify the name
// of the output cluster ID property.
var clusteredFc = pointSampleFc . cluster ( clusterer , 'spectral_cluster' );
print ( 'Note added "spectral_cluster" property for an example feature' ,
clusteredFc . first (). toDictionary ());
// Visualize the clusters by applying a unique color to each cluster ID.
var palette = ee . List ([ '8dd3c7' , 'ffffb3' , 'bebada' , 'fb8072' , '80b1d3' ]);
var clusterVis = clusteredFc . map ( function ( feature ) {
return feature . set ( 'style' , {
color : palette . get ( feature . get ( 'spectral_cluster' )),
});
}). style ({ styleProperty : 'style' });
// Display the points colored by cluster ID with the S2 image.
Map . setCenter ( - 122.35 , 37.47 , 9 );
Map . addLayer ( image , { bands : [ 'B4' , 'B3' , 'B2' ], min : 0 , max : 1500 }, 'S2 image' );
Map . addLayer ( clusterVis , null , 'Clusters' ); পাইথন সেটআপ
পাইথন এপিআই এবং ইন্টারেক্টিভ ডেভেলপমেন্টের জন্য geemap
ব্যবহার করার জন্য পাইথন এনভায়রনমেন্ট পৃষ্ঠাটি দেখুন।
import ee
import geemap.core as geemap Colab (পাইথন)
# Import a Sentinel-2 surface reflectance image.
image = ee . Image ( 'COPERNICUS/S2_SR/20210109T185751_20210109T185931_T10SEG' )
# Get the image geometry to define the geographical bounds of a point sample.
image_bounds = image . geometry ()
# Sample the image at a set of random points a feature collection is returned.
point_sample_fc = image . sample (
region = image_bounds , scale = 20 , numPixels = 1000 , geometries = True
)
# Instantiate a k-means clusterer and train it.
clusterer = ee . Clusterer . wekaKMeans ( 5 ) . train ( point_sample_fc )
# Cluster the input using the trained clusterer optionally specify the name
# of the output cluster ID property.
clustered_fc = point_sample_fc . cluster ( clusterer , 'spectral_cluster' )
display (
'Note added "spectral_cluster" property for an example feature' ,
clustered_fc . first () . toDictionary (),
)
# Visualize the clusters by applying a unique color to each cluster ID.
palette = ee . List ([ '8dd3c7' , 'ffffb3' , 'bebada' , 'fb8072' , '80b1d3' ])
cluster_vis = clustered_fc . map (
lambda feature : feature . set (
'style' , { 'color' : palette . get ( feature . get ( 'spectral_cluster' ))}
)
) . style ( styleProperty = 'style' )
# Display the points colored by cluster ID with the S2 image.
m = geemap . Map ()
m . set_center ( - 122.35 , 37.47 , 9 )
m . add_layer (
image , { 'bands' : [ 'B4' , 'B3' , 'B2' ], 'min' : 0 , 'max' : 1500 }, 'S2 image'
)
m . add_layer ( cluster_vis , None , 'Clusters' )
m
মতামত জানান
অন্য কিছু উল্লেখ না করা থাকলে, এই পৃষ্ঠার কন্টেন্ট Creative Commons Attribution 4.0 License -এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License -এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-07-24 UTC-তে শেষবার আপডেট করা হয়েছে।
আমাদের আরও কিছু জানাতে চান?
[[["সহজে বোঝা যায়","easyToUnderstand","thumb-up"],["আমার সমস্যার সমাধান হয়েছে","solvedMyProblem","thumb-up"],["অন্যান্য","otherUp","thumb-up"]],[["এতে আমার প্রয়োজনীয় তথ্য নেই","missingTheInformationINeed","thumb-down"],["খুব জটিল / অনেক ধাপ","tooComplicatedTooManySteps","thumb-down"],["পুরনো","outOfDate","thumb-down"],["অনুবাদ সংক্রান্ত সমস্যা","translationIssue","thumb-down"],["নমুনা / কোড সংক্রান্ত সমস্যা","samplesCodeIssue","thumb-down"],["অন্যান্য","otherDown","thumb-down"]],["2025-07-24 UTC-তে শেষবার আপডেট করা হয়েছে।"],[[["Groups features within a collection into clusters based on a provided clusterer."],["Assigns each feature a cluster ID, stored in a new property with a user-defined name (defaults to \"cluster\")."],["Requires a trained clusterer and a FeatureCollection where each feature contains the necessary properties for clustering."],["Returns a new FeatureCollection with the added cluster ID property."]]],[]]