I am taking a random sample of points from a landcover raster in GEE. I then overlay those points with other rasters and extract pixel values (to be used for regression analysis). I want to know what coordinate system the returned sampled points will be in, and whether I need to specify that crs when overlaying the sample featureCollection with future rasters. For example, in the code example below, what is the crs of the lat-lons returned in point_sample, and how should that crs be enforced when overlaying the points with the new elevation raster?

Based on the documentation of ee.Image.sample, the projection of the image's first band is used in sampling (unless a different projection is specified). I am guessing that this means that the lat-lons returned will be in the crs of my gap raster (EPSG:5070) and that when overlaying the points with the elevation raster, I must specify that as my projection, otherwise, the points will not be correctly interpreted. Is that a correct statement?

# Extract 100 random points from the landcover raster
gap = ee.Image('USGS/GAP/CONUS/2011');
point_sample = gap.sample(
  scale= 30,
  numPixels= 100,
  seed= 10,
  geometries= True

# Overlay the points with a new ratser and extract the pixel values
elevation = ee.Image('USGS/NED')
def extract(point):    
    elev_val = elevation.reduceRegion(
          reducer= ee.Reducer.first(),
          geometry= point.geometry(),
    return point.set(elev_val)


1 Answer 1


Your understanding is about 1/2 correct, but ultimately, the answer is no, you don't need to specify a crs.

When you sample the landcover this way, you get values sampled from the original raster using its CRS (apparently EPSG:5070 in this case), however the coordinates returned with each point, when geometries is true, are just the corresponding lat/lon. There aren't in any projection; they're just latitude and longitude. Technically, it's the location of the center of the 30m EPSG:5070 pixel, but the lat/lon values are still just a location on the WGS84 sphere, not in any specific projection.

You can use those coordinates to sample any other raster in whatever CRS it is in; Earth Engine will do the appropriate conversion automatically and you don't need to specify a CRS in order to use them.

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.