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:
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!
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
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP