1

When I use “Export.image.toDrive” command in Google Earth Engine it requests to define the scale and CRS of the raster. I did a search, but could not find clear solution for it.

Is there any possibility to keep native scale and CRS of the image while exporting it?

4

The scale and the CRS are optional when Exporting to Drive. By default, the CRS is the native one, and the resolution is 1000M per pixel. To set the native resolution:

var myScale = myImage.projection().nominalScale()

When using myScale in the Export.image.toDrive() you need to turn the variable to a local one with the function getInfo()

Export.image.toDrive({ image: myImage, scale: myScale.getInfo() });

2
  • This does not seem to work for me. I tried passing myScale as the argument to scale in Export.image.toDrive but get this text in the scale box when I hit run: ee.Number({ "type": "Invocation", "arguments": { "proj": { "type": "Invocation", "arguments": { "image": { "type": "Invocation", "arguments": { "id": "JRC/GSW1_1/MonthlyHistory/2000_07" }, "functionName": "Image.load" } }, "functionName": "Image.projection" } }, "functionName": "Projection.nominalScale"}) – Heymans Jun 9 '20 at 0:10
  • 1
    You are right. It is due to the mixture of server and local functions. Export.image.toDrive is a local function, so it cannot access server variables. add ".getInfo()" to the end of the variable and it will turn it to a local variable. I have edited the answer to reflect this. – Sean Roulet Jun 9 '20 at 12:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.