1

I'm searching how to export an image from earth engine to the drive. But I would like my image to be a sattelite one. How can I do it ? Is it possible? Thank you in advance.

I have already read the doc of earth engine. I find this programm :

var landsat = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_123032_20140515') .select(['B4', 'B3', 'B2']);

 // Create a geometry representing an export region. 
var geometry = ee.Geometry.Rectangle([116.2621, 39.9, 116.3849, 40.0]);

 // Export the image, specifying scale and region.
 Export.image.toDrive({ image: landsat, description: 'test', scale: 30, region: geometry, format:"png" });

But it give me a corrupted file

KcFnMi
  • 5,516
  • 10
  • 62
  • 136
Antoine Guil
  • 21
  • 1
  • 3
  • Start here: https://developers.google.com/earth-engine/getstarted And please follow the question guidelines here on Stackoverflow! Which image do you want to export? Just any one of the millions of satellite images in Earth Engine? – Joooeey Jan 22 '18 at 22:32

2 Answers2

1

The only thing that I see wrong with the code you provide is that format is not one of the parameters that you can pass to the Export.image.toDrive() function.

When I deleted the format: "png" part of your code, I got a file called test.tif in my Google Drive that I expected. In the Google Earth Engine Javascript editor, the only format that an image can be exported in is a geotiff (.tif) file.

var landsat = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_123032_20140515').select(['B4', 'B3', 'B2']);

// Create a geometry representing an export region. 
var geometry = ee.Geometry.Rectangle([116.2621, 39.9, 116.3849, 40.0]);

// Export the image, specifying scale and region. 

Export.image.toDrive({ image: landsat, description: 'test', scale: 30, region: geometry});

Here's a link to that script.

Keep in mind that the 3-band image that you get from this code may not render very well in some applications, even though all the data are still there. It may appear that the file is corrupted, but the code does produce a usable geotiff file.

To illustrate this, when I open the file in Preview on my mac, it looks like this:

test.tif opened in Preview

But if I open it in QGIS, then it looks like this:

test.tif opened in QGIS

mikoontz
  • 592
  • 5
  • 11
1

In addition to mikoontz 's answer, you cannot just view a GeoTIFF image using just a regular image viewer, rather try using any GeoTIFF image viewer software.

A list of viewers : https://www.gislounge.com/free-gis-data-viewers/

Note: most of these are not just viewers, they are capable of doing doing much more than just viewing GeoTIFF images.

shubham
  • 576
  • 4
  • 7