Geographic Information Systems Asked on January 6, 2022
When exporting an image to an asset in Google Earth Engine, the task seemingly runs fine but outputs only a tiny corner of my image. It is a filtered, cloud-masked Sentinel-2 scene with 16 bands (13+ image corrections). It does not display any error messages so I assume that GEE thinks it is executing the task I have asked for. One thought I had was that I have used up too much space in my GEE assets folder but this is not the case. I have also tried a drive export and the outcome is the same. The pictures show a) what I was expecting the output to be and b) what it actually was.
Why is this happening and how can I fix it?
var geometry: polygon, 5 vertices
var collection: ImageCollection "Sentinel-2 MSI: MultiSpectral Instrument, Level-1C"
//define the cloud mask layer
function maskS2clouds(collection) {
var qa = collection.select('QA60');
var cloudBitMask = 1 <<10;
var cirrusBitMask = 1 <<11;
var mask = qa.bitwiseAnd(cloudBitMask).eq(0)
.and(qa.bitwiseAnd(cirrusBitMask).eq(0));
return collection.updateMask(mask).divide(10000);
}
//image collection is filtered
var dataset = ee.ImageCollection("COPERNICUS/S2")
.filterBounds(geometry)
.filterDate('2015-08-26', '2015-08-28')
.map(maskS2clouds);
//image with mask applied
var image = dataset.map(function(image) { return image.clip(geometry); });
Map.addLayer(image, RGB);
//exported to asset
Export.image.toAsset({
image:dataset.first(),
description: '2015_CLOUDFREE',
region: geometry,
scale: 10,
maxPixels: 1e13
});
var image = dataset.map(function(image) { return image.clip(geometry); });
Map.addLayer(image, RGB);
In this code you are displaying the entire image collection (despite its name, image
is an ImageCollection
) which is implicitly mosaiced by Map.addLayer
(all images are combined, taking the most recent available pixel).
//exported to asset
Export.image.toAsset({
image:dataset.first(),
...
In this code you are taking only the first image of the collection. To get the same result as addLayer
, use image: dataset.mosaic(),
instead.
Answered by Kevin Reid on January 6, 2022
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP