I made a copy of an Image that was shared with me as an asset in Google Earth Engine.

I expect the new copy to be identical to the image that was shared. To check that nothing was changed during export, I made a new image that is the difference between my two images, and I expect the result to be an image with uniform zero value.

var original = ee.Image("..."); //shared layer
var copy = ee.Image("...");

var difference = original.subtract(copy)

However, if I add difference to the map, it shows a pattern if I take a look from far away: enter image description here

Inspecting the value of pixels shows values other than zero.

However, the pattern fades away if I zoom in, and I only find zeros if I inspect pixel values. I've added some transparency to the layer in the capture, but you can see that it's a plain grey. enter image description here

Still, if I print the properties of my difference layer, it shows -255 and 255 as min and max values.

I think this is something about how GEE works with pyramids or pixel representation at different zoom scales. Indeed, the original and copy layers also look a bit different from the distance, but they look the same from close distance:


enter image description here


enter image description here

I'll zoom in to the island where the arrow points


enter image description here



Can I trust that the two layers are identical in their values and their difference is zero for every pixel?

  • I've seen this too and haven't found a trivial solution. An exhaustive one would be to run reduceRegions with an appropriate reducer on the difference image over a large area, but that takes time. Another thing to check are the image properties. Are the dimensions the same? Are the transform values the same? Sep 4, 2020 at 15:48
  • 1
    try to add the difference layer to the map reprojected to the orignal image projection. var proj = original.projection() and then Map.addLayer(difference.reproject(proj)....). If that works I post it as an answer Sep 5, 2020 at 11:58
  • Rodrigo, that didn't do the trick. I see where you are going, but I checked and the projections where the same before comparing them. Thanks for the suggestion thought! Sep 9, 2020 at 12:50
  • I have explored them further and, looking closely, the difference seems to be zero elsewhere. So I think it's a problem with how are piramids calculated. They are probably calculated in different ways, and that gives differences at other scales. Sep 9, 2020 at 12:50

1 Answer 1


Why don't you just do a frequency histogram of the values in your "difference image", over your region of interest? You should only find 0 values.

Such test would not be dependent on projection, though could eventually be dependent on the scale argument, facing the trade-off of faster (coarse scale to avoid the max pixel issue) versus precision (fine scale).

var checkit2 = difference.reduceRegion({
  reducer: ee.Reducer.frequencyHistogram(),
  geometry: ageometry,
  scale: 1000

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.