TransWikia.com

Altered projection in Google Earth Engine, how to correct?

Geographic Information Systems Asked by e5k on May 5, 2021

When I create a collection (named here geeCol) using Google Earth Engine, the projection displayed by geeCol.first().projection().getInfo() returns:

{'type': 'Projection', 'crs': 'EPSG:4326', 'transform': [0.25, 0.0, -180.0, 0.0, -0.25, 90.0]}

Based on this thread, I wrote a function that takes the average of multiple images within a time defined in days:

def makeComposite(collection, start, count, interval, units):
    sequence = ee.List.sequence(0, ee.Number(count).subtract(1)) # Create a sequence of numbers, one for each time interval. 
    originalStartDate = ee.Date(start) # Original start date

    def col(i):
        startDate = originalStartDate.advance(ee.Number(interval).multiply(i), units)
        # Get the end date of the current sequence.
        endDate = originalStartDate.advance(ee.Number(interval).multiply(ee.Number(i).add(1)), units)
        return collection.filterDate(startDate, endDate).reduce(ee.Reducer.mean())
    return ee.ImageCollection(sequence.map(col))

When I map this function on to my collection, the new projection is:

{'type': 'Projection', 'crs': 'EPSG:4326', 'transform': [1.0, 0.0, 0.0, 0.0, 1.0, 0.0]}

Since ‘crs’ is preserved but ‘transform’ is changed, I am wondering if:

  • This discrepancy really matters when I export my data to a csv
  • If it does, what is the appropriate way of redefining the ‘transform’ field of the projection? Since the function does not appear to truly change the projection, is it a matter of (i) using image.reproject() or (ii) image.setDefaultProjection()?

In other terms, I am unsure whether it is a matter of re-projecting the entire image or just to correct a field that was lost.

Merci!

One Answer

Per this page: "An image which is a composite or mosaic of input images with different projections will have the default projection, which is WGS84 with 1-degree scale"

Now, I don't believe the projections are different when you use the reduce method, but this has happened to me when I use the mosaic() method--the projection changes. In this case, I would explicitly reproject the output according to the transform you specified:

image.reproject({'crs': 'EPSG:4326', 'crsTransform': [0.25, 0.0, -180.0, 0.0, -0.25, 90.0]})

Hope this works!

Answered by eorland on May 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP