2

I ran a supervised classification in Google Earth Engine (GEE) using the following script.


// add an image, bounds, filter data and sort by cloud cover

var limitiNapoli = 'PathToMyasset'

var image = ee.Image(ee.ImageCollection(sentinel)    
.filterBounds(roi)    
.filterDate('2019-07-01', '2019-07-28')    
.sort('CLOUD_COVERAGE_ASSESSMENT')    
.first());
//Map.addLayer(image, {bands: ['B4', 'B3', 'B2'], max: 0.3}, 'image');

var imageNapoli = image.clip(limitiNapoli)
// Map.addLayer(imageNapoli, "", "ImageNapoli")

print (image)

// training data and merge. Printing training data
var newfc = urban.merge(water).merge(forest).merge(crops); 

// 'B2', 'B3', 'B4' 

var bands = [ 'B5', 'B6', 'B7', 'B8', 'B8A', 'B11', 'B12' ];
var training = image.select(bands).sampleRegions({
  collection: newfc, 
  properties: ['landcover'], 
  scale : 10
}); 
print(training);

var trueColor = {
  bands: [ "B4", "B3", "B2"], 
  min: 0,
  max: 3000 }; 

// train the classifier
var classifier = ee.Classifier.cart().train({ 
  features: training,
  classProperty: 'landcover', 
  inputProperties: bands
}); 

// run the classification 
var classified = image.select(bands).classify(classifier); 

// display classification
Map.centerObject(newfc, 12); 

Map.addLayer(imageNapoli, trueColor,  'Sentinel image Napoli'); 

  Map.addLayer(classified.clip(limitiNapoli), 
  { min: 0, max: 3, palette: ['CF521F', '39C3EE', '2F9516', '53FD29']},
  'classification'); 
// Map.addLayer(newfc); 

Map.addLayer(limitiNapoli, "", "Limiti Comune Napoli")

Export.image.toDrive({
  image: classified, //     <----- put the image you want to download
  description: "Land Cover Classification", 
  scale: 10, // <------ set the pixel size in meters
  region: exportation
});

As output i have a raster in which the pixels are classified into 4 different classes: water, urban, forest and crops.

I would like to validate the forest pixels by running an accuracy assessment using some ground truth data i have from the field (polygons). How could i do it?

2
  • is this validation of data is for a research purpose ? like PHD or Masters research ? Commented Jan 23, 2021 at 20:26
  • It's for research purpose, but it will not be published as scientificle article.
    – Carl
    Commented Jan 24, 2021 at 11:23

1 Answer 1

1

there are several options,

  1. run the code and use the base map of the Google Earth Engine to verify (easiest)
  2. find a classification with verified data then run the code and compare and contrast the accuracy of the classification method (more about the code less about the area of interest)
  3. buy a high res satellite image and verify the area (costliest)
  4. mark random or stratified sample point on the classified area and go to the actual location with the GPS coordinates and verify by your self (most accurate and hardest)

or

run following analysis separately

  1. NDWI for water
  2. NDVI for forests
  3. Time Series analysis for Crops and cropping patterns
  4. NDBI for built up area.

then verify the data from the code with the above analysis.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.