I am facing a technical difficulty with Google Earth Engine

I am trying to retrieve the albedo value of the state of Idaho by using Landsat7 TOA reflectance imagery over the span of a year. ('2005-01-01','2005-12-31').

The equation to retrieve the albedo is known as:

var albedo = ((0.356*blue)+(0.130*red)+(0.373*nir)+(0.085*swir)+
(0.072*swir2)- 0.018)/ (1.016);

Here is the whole code that I have so far:

var region = table;
var col05 = donnee.filterBounds(region).filterDate('2005-01-01', '2005-12-31');
var calc_albedo = function(donnee){
  var red = donnee.select('B3');
  var blue = donnee.select('B1');
  var nir = donnee.select('B4');
  var swir = donnee.select('B5');
  var swir2 = donnee.select('B7');
  var albedo = ((0.356*blue)+(0.130*red)+(0.373*nir)+(0.085*swir)+(0.072*swir2)- 0.018)/ (1.016);
  return albedo
var albedo_2005 = col05.map(calc_albedo);
var clipped05 = albedo_2005.median().clip(region);
strong textMap.addLayer(clipped05,{min: 0.0, max: 1},'albedo_2005');

var region = table is a shapefile of the Idaho state I have upload via the tool google provides. var donnee is the ImageCollection "USGS Landsat 7 TOA Reflectance (Orthorectified)"

Finally, the error I am receiving is :

albedo_2005: Layer error: reduce.median, argument 'collection': Invalid type. Expected: ImageCollection. Actual: FeatureCollection.

  • What happens if you cast the feature to an image, e.g. as return ee.Image(albedo)?
    – Kersten
    Dec 11, 2017 at 12:47

1 Answer 1


You can't do math that way (using javascript math operators) due to client/server issues. To do something similar, you need to use image.expression:

var albedo = donnee.expression(
  "((0.356*blue)+(0.130*red)+(0.373*nir)+(0.085*swir)+(0.072*swir2)- 0.018)/ 1.016",
    red: donnee.select('B3'),
    blue: donnee.select('B1'),
    nir: donnee.select('B4'),
    swir: donnee.select('B5'),
    swir2: donnee.select('B7')

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.