I'm fairly new in Google Earth Engine and JavaScript. I'm trying to convert Landsat8 DN to TOA reflectance using GEE using a function.

// Load a raw Landsat scene and display it.
var image = ee.Image('LANDSAT/LC08/C01/T1/LC08_116050_20130425');
Map.centerObject(image, 10);
Map.addLayer(image, {bands: ['B4', 'B3', 'B2'], min: 6000, max: 12000},

// Compute the toa_radiance using an expression.
var toa = image.expression(
'(ML*QCAL)+AL', {
'ML': ee.Image(ee.Number(image.get('RADIANCE_MULT_BAND_1'))),
'AL': ee.Image(ee.Number(image.get('RADIANCE_ADD_BAND_1'))),
'QCAL': ee.Image(255.0)

print('Radiance: ', toa);
Map.centerObject(image, 9);
Map.addLayer(L, {min: -1, max: 255});

After loading running the script, I get a black image. What might probably be wrong?

1 Answer 1


May I ask, why are you going about it this way instead of using the built-in function for this purpose: ee.Algorithms.Landsat.TOA(input) ? Have a look at the documentation, but I suspect this might be what you're after.

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.