Skip to main content
syntax highlighting
Source Link
Kersten
  • 9.9k
  • 3
  • 39
  • 59
 

The Google Earth Engine Developers group just provided two solutions - one quick fix and one more elegant.

The quick fix - filter out the "wet" features, then add those as a unique layer. Then filter out the "dry" features, and add those as a second layer. Here's the code used to filter out wet features:

    var Wet = ee.FeatureCollection(fieldObs.filter(ee.Filter.eq('water_stat', 'Wet')));
    print(Wet)
    var Wet = ee.FeatureCollection(fieldObs.filter(ee.Filter.eq('water_stat', 'Wet')));
    print(Wet)

The more elegant solution was provided by Noel Gorelick:

Map over the features, give each feature a "style" dictionary containing a >"color" property based on its status.
Then call collection.style(), passing the name of the style dictionary >property. See this example: https://code.earthengine.google.com/a9ba80f9d412c918f3499261f5d435e7

In Noel's method, the entire FeatureCollection can be added as a single layer, with unique colors based on feature properties. Just what I was looking for.

The Google Earth Engine Developers group just provided two solutions - one quick fix and one more elegant.

The quick fix - filter out the "wet" features, then add those as a unique layer. Then filter out the "dry" features, and add those as a second layer. Here's the code used to filter out wet features:

    var Wet = ee.FeatureCollection(fieldObs.filter(ee.Filter.eq('water_stat', 'Wet')));
    print(Wet)

The more elegant solution was provided by Noel Gorelick:

Map over the features, give each feature a "style" dictionary containing a >"color" property based on its status.
Then call collection.style(), passing the name of the style dictionary >property. See this example: https://code.earthengine.google.com/a9ba80f9d412c918f3499261f5d435e7

In Noel's method, the entire FeatureCollection can be added as a single layer, with unique colors based on feature properties. Just what I was looking for.

 

The Google Earth Engine Developers group just provided two solutions - one quick fix and one more elegant.

The quick fix - filter out the "wet" features, then add those as a unique layer. Then filter out the "dry" features, and add those as a second layer. Here's the code used to filter out wet features:

    var Wet = ee.FeatureCollection(fieldObs.filter(ee.Filter.eq('water_stat', 'Wet')));
    print(Wet)

The more elegant solution was provided by Noel Gorelick:

Map over the features, give each feature a "style" dictionary containing a >"color" property based on its status.
Then call collection.style(), passing the name of the style dictionary >property. See this example: https://code.earthengine.google.com/a9ba80f9d412c918f3499261f5d435e7

In Noel's method, the entire FeatureCollection can be added as a single layer, with unique colors based on feature properties. Just what I was looking for.

Source Link
Anson Call
  • 423
  • 4
  • 11

The Google Earth Engine Developers group just provided two solutions - one quick fix and one more elegant.

The quick fix - filter out the "wet" features, then add those as a unique layer. Then filter out the "dry" features, and add those as a second layer. Here's the code used to filter out wet features:

    var Wet = ee.FeatureCollection(fieldObs.filter(ee.Filter.eq('water_stat', 'Wet')));
    print(Wet)

The more elegant solution was provided by Noel Gorelick:

Map over the features, give each feature a "style" dictionary containing a >"color" property based on its status.
Then call collection.style(), passing the name of the style dictionary >property. See this example: https://code.earthengine.google.com/a9ba80f9d412c918f3499261f5d435e7

In Noel's method, the entire FeatureCollection can be added as a single layer, with unique colors based on feature properties. Just what I was looking for.