Geographic Information Systems Asked by BiH on January 1, 2021
I am trying to reproject an image collection, but it fails after I apply filtering by (space, time, and cloudy cover percentage)!?
Here is the code:
Map.centerObject(geometry);
var S2_f = S2.filterDate('2018-07-03', '2018-07-24')
.filterBounds(geometry)
.filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 5));
Map.addLayer(S2_f, {min: 0, max:3000, bands: ['B4', 'B3', 'B8A']},'Before Reprojection');
print('projection original', S2_f.projection());
var proj = ee.Projection('EPSG:2062');
print('nominal scale', proj.nominalScale());
var S2_r = S2_f.reproject(proj, null, 10);
Map.addLayer(S2_r, {min: 0, max:3000, bands: ['B4', 'B3', 'B8A']}, 'After Reprojection');
The error message is:
S2_f.projection is not a function
https://code.earthengine.google.com/20877d4ab79887bbbb663ffe89367b2e
You can't reproject an ImageCollection. You can only reproject images. So your code would work like this:
var S2_r = S2_f.first().reproject(proj, null, 10);
If you want to reproject all images in the collection you need to map over the collection and reproject every single Image.
var S2_r = S2_f.map(function(image){
return image.reproject(proj, null, 10);
})
However be aware that unless you absolutely need to reproject an Image, it is not advised to do so, since it can add a lot of unnecessary processing overhead. See https://developers.google.com/earth-engine/guides/projections
Correct answer by JonasV on January 1, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP