1

I've written below code for crs_transform extraction from sentinel2 images but it returns null value. How can I solve this problem?

var B5 = ee.ImageCollection("COPERNICUS/S2")
.filterDate('2016-01-01','2016-02-01')
.filterBounds(table)
.select('B4');


print(B5.get('crs_transform'));

1 Answer 1

2

To retrieve crs_transform i recommend working with a single image from the collection, extracting the projection information and retrieving the crsTransform from the projection obeject, like so

var crs_transform = B5.first().projection().transform()

optionally and may necessarily you'll need to extract the transform as a definite value and not an object. this is(or maybe was) the case when exporting Images or reducing images by Region(s). In this case, the following will help:

var crs_transform = B5.first().projection().getInfo().transform

the .getInfo() forces the Earthengine to determine an object to a value in your Console. Fixes many issues with dynamic coding in the Earth Engine.

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.