Geographic Information Systems Asked by Javier Fajardo on August 24, 2020
I am doing calculations in Google Earth Engine using several images from different sources, but I don’t find a way to snap or pixel-align the layers before calculations.
Also, I don’t seem to understand how GEE is working, because the same function lets me snap image1 to image2, but does nothing if I try to snap image2 to image1.
These are snapshots of my two images, and a third one where I have changed transparency to show that pixels do not overlap:
image2 (land cover from Copernicus)
image1 and image2 (50% transparency) – notice the misalignment between pixels
This is what I get when I print .projection()
for both layers (notice that some of the extent values differ)
image1
Then, I want to snap/align image2 using image1 as a template. This is the code I’m using:
var image2_aligned = image2.reproject({
crs: image1.projection().crs(),
scale: image1.projection().nominalScale()
})
However, the result is still misaligned
image1 and image2_aligned (50% transparency)
The result is identical to my original layer
But, if I do the opposite, align image1 using image2 as a template, the same code works as I expect
var image1_aligned = image1.reproject({
crs: image2.projection().crs(),
scale: image2.projection().nominalScale()
})
image1_aligned and image2 (50% transparency)
Why does this happen?
How can I get a version of image2 that aligns pixels in image1?
Also, a less practical question. Because I come from QGIS and R, my old mindset kind of wants to do that step manually but, is it necessary at all? GEE would do the calculations even if pixels are not aligned, but I feel it’s better to align the images myself than letting it out for GEE, as I wouldn’t have control over what it’s doing under the shadow (but not that there is anything particularly important to control in this case…)
Final note: I’ve read documentation for GEE images, .projection()
, and .reproject()
, but I’m too new to make sense of everything. Also, I’ve read answers to this other question, but I don’t think it’s exactly the same… or, at least, it’s not helping me finding a solution.
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP