1

I have a FeatureCollection of the Burmese state and region boundaries. As my study site only includes one state (the Ayeyarwady Region), I would like to mask my other data (mangrove cover, in this case) by this state.

I tried the following:

// Load state and region boundaries of Myanmar
var MMR_RegionBoundaries = ee.FeatureCollection('users/simonsesytze/aeo_research/MMR_region_boundaries')

// Select Ayeyarwady Region
var AyeyarwadyBoundary = ee.Feature(MMR_RegionBoundaries.select('Ayeyarwady'))

// Load Global Mangrove Watch coverage
var GMW_2016 = ee.FeatureCollection('users/simonsesytze/aeo_research/GMW_2016')

// Filter mangroves to Ayeyarwady Region
var GMW_Ayeyarwady = GMW_2016.filterBounds(AyeyarwadyBoundary)

// Display layer
Map.addLayer(GMW_Ayeyarwady, {}, 'Mangroves in Ayeyarwady Region');

However, this results in an error:

Mangroves in Ayeyarwady Region: Layer error: Feature, argument 'geometry': Invalid type.
Expected type: Geometry.
Actual type: FeatureCollection.

How can I extract a geometry from the FeatureCollection and use it to mask a layer to?

Sytze
  • 345
  • 2
  • 12

1 Answers1

0

Try

var GMW_Ayeyarwady = GMW_2016.filterBounds(AyeyarwadyBoundary.geometry());
Jesse Anderson
  • 4,507
  • 26
  • 36