Get the stats of your primitive

From a histogram

 

var referenceData = ee.FeatureCollection("users/servirmekong/cambodia/paddyRice")

// import feature collection
var table = ee.FeatureCollection("users/servirmekong/countries/KHM_adm1");
// import surface reflectance composite
var composites = ee.ImageCollection("projects/servir-mekong/yearlyComposites");

// filter for province
var province = "Batdâmbâng";

// select province from feature collection
var myProvince = table.filter(ee.Filter.eq("NAME_1","Batdâmbâng"));

// filter image for date
var image = ee.Image(composites.filterDate("2002-01-01","2002-12-31").first());

// add image to map
Map.addLayer(image.clip(myProvince),{min:0,max:3000,bands:"red,green,blue"},"2018");

var trainingSample = image.sampleRegions(referenceData,["land_class"],30);

var bandNames = image.bandNames();
var classifier = ee.Classifier.randomForest(100,0).setOutputMode('PROBABILITY').train(trainingSample,"land_class",bandNames);

var classification = ee.Image(image.classify(classifier).multiply(100).clip(myProvince));

Map.addLayer(classification,{min:20,max:80,palette:"white,gray,black"},"primitive");

// import lc feature collection
var lc = ee.FeatureCollection("users/servirmekong/cambodia/Landuse2002");

// filter for paddy rice
var rice = lc.filter(ee.Filter.eq("NAME","Paddy field"));

// add the rice features
Map.addLayer(rice,{},"rice");

// add the chart
print(ui.Chart.image.histogram(classification,rice,900));

link

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s