1

I am using google earth engine to classify landcover. The training samples are trained in google earth and processed in ArcGIS and then I uploaded the shapefiles as a table in GEE. I specify the property for each land cover class ( e.g: water: landscape 0, urban: landscape 1). Here's my code

/// Merge the hand-drawn features into a single FeatureCollection.
var newtrainingpolygons = Barren_Train.merge(Urban_Train).merge(Water_Train).merge(Taiga_Train).merge(Tundra_Train);

var bands = ['B2_median','B3_median','B4_median','B5_median','B6_median','NDVI_max'];

var training = Landsat_Composite5.select(bands).sampleRegions({
  collection: newtrainingpolygons, 
  properties: ['Landscape'], 
  scale: 30
}).randomColumn('random');

///Train the classifier
var classifier = ee.Classifier.randomForest(30).train({
  features:training,
  classProperty:'Landscape',
  inputProperties: bands
});

var classified = Landsat_Composite5.select(bands).classify(classifier);

I am getting the layer error every time.What does it even mean.

Angel Politis
  • 10,955
  • 14
  • 48
  • 66
TS2918
  • 11
  • 2

1 Answers1

1

I had the same problem. I'd created vectors in QGIS and then exported them to GEE.

To my mind, the problem is that when you edit the properties of the Asset, you don't edit the properties of the vector, but the properties of the EE.Collection instead. So the vectors don't have the "Landscape" property in their DBF file.

To solve this problem it is necessary to incorporate a column with the name "Landscape" during the creation of the vector in the original platform. This column has to be floating point number.

I hope that this could help you to solve the problem.

Once that the vector is in a right way, you can export it to GEE.

Pauloco
  • 1,049
  • 1
  • 10
  • 19