2

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.

1 Answer 1

2

Per Projections 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]})

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.