I am a bit new to classification within GEE and was hoping to get some help regarding classifying within a specific region.

var bands = ['NDVI'];

var landSat = ee.Image(ee.ImageCollection('LANDSAT/LC08/C01/T1_8DAY_NDVI')
  .filterDate('2014-5-01', '2014-5-10')

var landSatTest = ee.Image(ee.ImageCollection('LANDSAT/LC08/C01/T1_8DAY_NDVI')
  .filterDate('2014-5-01', '2014-5-10')

//Merging imports of sample regions into one feature collection 
var trainingFC = not_fallowed.merge(fallowed);

//Training data
var training = landSat.select(bands).sampleRegions({
  collection: trainingFC,
  properties: ['landcover'],
  scale: 30

//Random Forest Classifier Training
var trained = ee.Classifier.randomForest().train({
  features: training,
  classProperty: 'landcover', 
  inputProperties: bands

//Run classification 
var classified = landSatTest.select(bands).classify(trained);

//Displaying results
Map.centerObject(iqROI, 7.5);

//70FF00 (green) not fallowed, FF2D000 (red) fallowed
Map.addLayer(classified, {min: 0, max: 1, palette: ['70FF00', 'FF2D00']}, 

So rather than defining a new ROI within landSatTest I would like to apply it to my FeatureCollection in order to only classify that area as I am only interested in that area's outputs. Otherwise it seems I get an area that adds a lot of extra space.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.