5

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?

1 Answer 1

7

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() });

3
  • 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
    Commented Jun 9, 2020 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. Commented Jun 9, 2020 at 12:05
  • It should also be noted that any reducer, mosiac, or compositing actions applied to the image will set its nominalScale back to 1 degree
    – lusk
    Commented Mar 26 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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