0

I would like to extract data from certain satellite images (e.g. average night lights) in GEE for square grids in a given country in order to analyse the data in R. The square grids are supposed to be rather small (100x100m²). What is the most efficient way to accomplish that?

My current approach would be to create a suitable shapefile in R, upload that to GEE, extract the data and download the results. Unfortunately it's computationally very intensive to do this for such small grids (and currently I'm not sure GEE allows me to do that). Is there a more efficient alternative to get to my goal?

tho_mi
  • 698
  • 3
  • 9
  • 16
  • Do the grids need to be in a specific location, and do you need the raw values in each grid, or just summaries? – Jesse Anderson Apr 08 '19 at 20:02
  • Sorry for the late reply @blindjesse. The grids don't need to be in a specific location. The answer to the second question depends on the data. Eg in case of night lights a (weighted) mean would be fine, in case of land cover I'd like to have the absolute or relative area of that grid covered for each type of land cover. – tho_mi Apr 13 '19 at 02:54
  • What about just exporting the image for the country at the desired resolution (100m)? – Jesse Anderson Apr 13 '19 at 19:31
  • Is it possible to download the data in a higher resolution than the source file? I'm currently downloading the data in the native resolution and then do the rest in R. – tho_mi Apr 13 '19 at 19:33
  • Yeah, `Export.image` has a scale argument. I can code it up as an answer if you want. – Jesse Anderson Apr 14 '19 at 15:06
  • That would be awesome. I guess it should be possible to combine several images by using one band for each image? The only big question that comes to my mind is how to get the grid to R (more specifically, to a SpatialPolygonsDataFrame), so I can analyze it there. But I guess there should be a way. – tho_mi Apr 14 '19 at 15:15

1 Answers1

0

Here's how you can export an ee.Image for the desired region at a different scale.

// Example night lights image 
var nl = ee.ImageCollection('NOAA/VIIRS/DNB/MONTHLY_V1/VCMCFG').first().select(0);

// All countries
var countries = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017');

// For example
var brazil = countries.filter(ee.Filter.eq('country_na', 'Brazil'));
Map.addLayer(brazil)

// Desired output resolution in meters.
var scale = 100;

// export the image at the desired scale
Export.image.toDrive({ image: nl,
                       region: brazil,
                       scale: scale });
Jesse Anderson
  • 4,507
  • 26
  • 36