Search code examples
mapsresolutiongoogle-earth-engine

Google Earth Engine: How can I perform the comparison of two maps (different resolutions)?


I have two maps- Hansen 30m forest cover and another product of 500 m resolution. I want to look on correlation between these two maps at 500 m resolution.

Does anyone know, how to aggregate one map (30 m) to the resolution of another (500 m) in Google Earth Engine, so they will perfectly overlay?

Thanks in advance!


Solution

  • In Google Earth Engine you don't have to worry about it: the scaling happens automagically and they will overlay perfectly. Of course lack of control can be an issue for certain applications, but to my knowledge there is not much you can do about it.

    Now, to the point: scaling Hansen's map (Global Forest Change - GFC) to lower resolution map:

    The GEE loads the data internally at native resolution and then generates down-sampled versions at multiples of two, until the entire image fits in a single tile. Then, GEE fetches the down-sampled pixels from the nearest higher level of the pyramid, and re-samples those to the requested scale. For bands that cannot be interpolated, like GFC's "lossyear" (pixel value indicating the year loss occurred), the GEE selects the first value (of the four "child" values) at each pyramid level.

    In other words, if we consider example of a treecover2000 band with the following pixel values

    10 20

    30 40

    the down-sampling will result in value '25'. The categorical values like 'lossyear' will scale differently:

    1 2

    3 4

    Here the result will be simply "1"