Geographic Information Systems Asked by jkff on April 16, 2021
I am trying to get Google Earth Engine to export many polygons of an Image
(thousands all around the world, training data for an ML model) into .tif
files on Google Cloud Storage, using a single GEE export task, because given how many polygons I want to export, having 1 export task per polygon results in the whole thing taking days.
As a prototype, I’m trying only 2 polygons, and exporting simply some pre-existing Landsat data.
The code below tries to do that by clipping the Image
to the union of the polygons, and exporting a region which is the bounding rectangle of them all, but with skipEmptyTiles: true
.
Unfortunately, it does not have the required effect – despite skipEmptyTiles
, the code produces a bunch of empty tiles (identical completely black .tif
files). The non-empty tiles look correct.
Is this a bug in GEE? Am I doing something wrong?
var landsat = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_123032_20140515')
.select(['B4', 'B3', 'B2']);
// Brighten a bit
landsat = landsat.add(landsat).add(landsat).add(landsat);
var r1 = ee.Geometry.Polygon([[116.256, 40.515], [116.343, 40.544], [116.313, 40.632], [116.146, 40.632], [116.135, 40.565]]);
var r2 = ee.Geometry.Polygon([[116.819,40.333], [116.926,40.362], [116.852,40.460], [116.662,40.456], [116.668,40.335]]);
var union = r1.union(r2);
var bounds = union.bounds();
// Produces 28 .tif's totaling 32MB and tiling the region 4x7.
// Despite skipEmptyTiles, 20 of the tiles are completely black.
Export.image.toCloudStorage({
image: landsat.clip(union),
bucket: 'ekirpichov-gee-test',
description: 'union',
scale: 100,
region: union.bounds(),
skipEmptyTiles: true
});
// Debugging
Map.centerObject(landsat);
Map.addLayer(r1, {color: 'FF0000'});
Map.addLayer(r2, {color: '00FF00'});
Map.addLayer(landsat.clip(union), {}, 'landsat');
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP