I am reading the geemap tutorial and I have question about the sampleRegions function. As I understand, this function "cross" between vector data (feature collection) and a given raster, and generates new feature collection with the pixel value for each point. However, I don't understand what is the geometries parameter is for:


isn't it suppose by deafult to include point geometry per pixel? why wouldn't it? which geometries will be omitted? not sure I understand how to use this parameter and how it works.

1 Answer 1


When false, the features in the resulting feature collection will not include the geometry of their corresponding region, only the sampled band values.

A very common use-case where you don't need to include the geometry is when you are creating a training data-set for a classifier. The classifier only cares about the band values and the class:

var trainingData = image.sampleRegions({
  collection: referenceData, 
  scale: 10, 
  geometries: false // We don't need the geometries here

var classifier = ee.Classifier.smileRandomForest(5)
  .train(trainingData, 'value')
var classification = image.classify(classifier)


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.