The goal is to select certain images from an image collection of Landsat 5 raw scenes, which possess a property called RADIANCE_MAXIMUM_BAND_6, since not all images contain this property.

if (property === null) { var index = 0} else { index = 1}

does not work, because apparently null is not the right condition, even if print(property) yields null

What's the right statement?

Rodrigo is right, this is neither specific enough nor an API friendly way. I think it would be easier with a filter

var filtered = L5.filterMetadata('RADIANCE_MAXIMUM_BAND_6',"not_contains",null) and

var filtered = L5.filter(ee.Filter.notNull(ee.List('RADIANCE_MAXIMUM_BAND_6')))

doesnt work.

Which metadata is meant i.e. the properties of the Collection or those of the images?

to be specific: what I want to filter a Collection depending on if an Image has the property 'RADIANCE_MAXIMUM_BAND_6'. Because some images just do not have this property.

  • 1
    You should provide a reproducible code so we can better understand what's the issue and how to solve it Jan 20, 2019 at 1:05

2 Answers 2


Try this (the aside(print) is to see that the size changes):

var L5 = ee.ImageCollection("LANDSAT/LT05/C01/T1");

var geometry = ee.Geometry.Point([-121.96269531249999, 38.086752154007726]);

var filtered = L5
    .filter(ee.Filter.neq('RADIANCE_MAXIMUM_BAND_6', null))

Have you tried this?

var property = 6

property = property || "Nothing here"

if(property === "Nothing here"){
  print("zero", property)
 print("something Else:", property)

In the above example if your property is null or 0, it is given the value of "Nothing Here"

Then with a similar if statement you can check for "Nothing Here" and decide what to do next.

  • I guess this will not work because he may want to do this in a mapping function, thus it has to be "server side", and your solution will work only in the "client side". But he should modify the question to be more specific Jan 20, 2019 at 1:08
  • i dont know wich value to use for "Nothing here" , and also i agree with Rodrigo, there is Probably an API friendly way of doing so. I am just not experienced enough to find it Jan 20, 2019 at 9:34

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.