I am trying to randomly sample 250x250 pixel tiles from a big Image, let's say 40000x40000. In this case the big Image would be the Hansen Dataset. I want to sample points in which a forest loss has occured. Then around each of those sampled points I want to extract a 250x250 pixel tile that contains that pixel. Each pixel has to correspond to a scale of 30m per pixel.

This is what I have done so far:

var hansen = ee.Image('UMD/hansen/global_forest_change_2018_v1_6');
var clippedHansen = hansen.clip(region);
var samples = clippedHansen.stratifiedSample({
  numPoints: 30,
  classBand: 'loss',
  scale: 30,
  classValues: [0, 1],
  classPoints: [0, 30],
  geometries: true

With this I get a FeatureCollection that contains the sampled points. How can I get a 250x250 pixel tile around each point? PS: it does not matter whether the location of that point is on the top-left corner, on the middle, etc. of the tile I want to get. And how can I make sure that each pixel correspond to 30m?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.