I have feature collection of 200 points and raster which is a result of sum of three bands of an Image. I want to create a table which will show the points (feature collection) and the value these points have on the raster, so the result should be table with 200 points and the value (from the raster). I have tried doing it with Sample region function, which runs, but gives me an empty feature collection.

This script simulates my steps:

original_image = ee.Image("projects/images/my_image");

img_sum = original_image.expression(
    'b1+b2+b3', {
      'b1': original_image.select('b1'),
      'b2': original_image.select('b2'),
      'b3': original_image.select('b3')

#after this I have visualized the results and checked if the sum really worked. It did.

#now- I want to create table which will have the points value at the pixel they stand on.


#this runs but when I do getInfo I get empty FeatureCollection:

{'type': 'FeatureCollection',
 'columns': {},
 'properties': {'band_order': ['b1']},
 'features': []}

Is there any possibility that this function is not really exists in geemap? I couldn't find it under the documentation .
my end goal is to extract the raster values for the points, and create new table from this.

1 Answer 1


It's hard to tell without a complete reproducible example. This should more or less do what you're asking for, I think:

import ee


# Generate dummy points
points = ee.FeatureCollection(ee.List.sequence(1, 200)
    lambda i: ee.Feature(ee.Geometay.Point([ee.Number(i), 0]))

image = ee.Image([
]).reduce(ee.Reducer.sum()) # Simple way to sum all bands

samples = image.sampleRegions(
  geometries=True # You said you wait to show the points, so you might want to include the geometries?
  • thanks! that worked. Little question - in the sum part, why did you do .random?
    – ReutKeller
    Aug 30, 2022 at 8:32
  • 1
    Just to generate a dummy image. Not something you'd do. Aug 30, 2022 at 8:37

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.