google / earthengine-community

Tutorials and content created by Earth Engine users, for Earth Engine users
https://earthengine.google.com/
Apache License 2.0
540 stars 707 forks source link

[Question] Sentinel-2 Cloud Masking with s2cloudless code tutorial #758

Closed marlonfs closed 7 months ago

marlonfs commented 7 months ago

@jdbcode I tried the code tutorial, and it seems the output s2_sr_median has crs EPSG:4326, which corresponds to WGS84 (World Geodetic System 1984, used in GPS).

My question: Shouldn't the cloud mask preserve the original projection provided by GEE? If I'm not mistaken, it is in UTM/WGS84, with EPSG varying according to the location on the globe.

jdbcode commented 7 months ago

@marlonfs, the EPSG:4326 output projection for s2_sr_median is expected because it is generated by a call to .median(). Functions that do composting use EPSG:4326 with 1-degree scale as a default because the inputs can be in multiple projections. See the projections guide page for more info. If you want the output in a specific projection, you can chain .setDefaultProjection onto the call to .median() (in this case). Also, for any downstream functions like reduceRegion or Export.* you can use the crs and scale (or crsTransform) parameters to set the desired projection. Hope this helps!