krishnab
krishnab

Reputation: 10060

Google Earth Engine: Finding the right image dimensions to get max resolution on satellite imagery

I am new to Google Earth Engine, and was trying to get Landsat imagery for the entire Democratic Republic of Congo. The project involves some computer vision and image segmentation, so I need to get the highest resolution possible.

I have some code that I developed from the earth engine to make a composite from 1 year of landsat imagery posted below.

var geometry = ee.Geometry.Polygon(
    [[[29.70703125, -3.3160183381615123],
      [24.609375, -3.4476246666468526],
      [24.8291015625, -7.732765062729807],
      [29.970703125, -7.645664723491028]]]);

// Composite 6 months of Landsat 8.

Map.setCenter(  26.362312, -4.643601, 5);
var boundingBox = geometry.bounds(1)
var L8 = ee.ImageCollection('LANDSAT/LC08/C01/T1');
var composite = ee.Algorithms.Landsat.simpleComposite({
  collection: L8.filterDate('2015-1-1', '2015-7-1').filterBounds(geometry),
  asFloat: true});
var region = ee.Geometry(geometry.getInfo())
                        .toGeoJSONString()
var params ={
      crs: 'EPSG:4326',
      region:region
    }
Export.image(composite,'congo_test',params);

The problem is that each time I run the script it asks me for the scale value. So I ask for the highest resolution, but the query keeps erroring out because it says that I have exceeded the maximum pixel limit for the image export.

So basically I need to figure out how to carve up congo into a set of blocks for which Earth Engine allows me to pull max resolution composite imagery. Does anyone know how I can calculate the correct size polygons to fit the bill?

Upvotes: 2

Views: 2495

Answers (2)

Noel Gorelick
Noel Gorelick

Reputation: 489

You should specify a scale in the export parameters. Composites don't have a native scale anymore, so they default to 1 degree per pixel. Since you started with landsat, you probably want a scale of 30.

Upvotes: 2

krishnab
krishnab

Reputation: 10060

As @Val indicated, the solution here was to apply the maxPixels parameter to the param variable in the javascript. The final javascript code below will automatically break up the image into chunks based upon the maxPixels parameter.

var geometry = ee.Geometry.Polygon(
    [[[29.70703125, -3.3160183381615123],
      [24.609375, -3.4476246666468526],
      [24.8291015625, -7.732765062729807],
      [29.970703125, -7.645664723491028]]]);

// Composite 6 months of Landsat 8.

Map.setCenter(  26.362312, -4.643601, 5);
var boundingBox = geometry.bounds(1)
var L8 = ee.ImageCollection('LANDSAT/LC08/C01/T1');
var composite = ee.Algorithms.Landsat.simpleComposite({
  collection: L8.filterDate('2015-1-1', '2015-7-1').filterBounds(geometry),
  asFloat: true});
var region = ee.Geometry(geometry.getInfo())
                        .toGeoJSONString()
var params ={
      crs: 'EPSG:4326',
      maxPixels: 1e12,
      region:region
    }
Export.image(composite,'congo_test',params);

This worked for me. Thanks @Val.

Upvotes: 1

Related Questions