export your new reference data

store it as an asset.

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

// import feature collection
var provinces = 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 = provinces.filter(ee.Filter.eq("NAME_1","Batdâmbâng"));

// filter for aoi
var lc = lc.filterBounds(myProvince);

// print all classes

// function to get the centroid
function getCentroid(feat){
return feat.centroid();

// filter for paddy rice and get the centroid
var rice = lc.filter(ee.Filter.eq("NAME","Paddy field")).map(getCentroid);
var other = lc.filter(ee.Filter.neq("NAME","Paddy field")).map(getCentroid);

// size of the data

var other = other.randomColumn("random").filter(ee.Filter.gt("random",0.9));

// size of other after filter

// add the points to the map
// add the points to the map

rice = rice.map(function(feat){return feat.set("land_class",1)})
other = other.map(function(feat){return feat.set("land_class",0)})

var merge = rice.merge(other)


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 )

Facebook photo

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

Connecting to %s