1

I use this link to extract surface area of water bodies from SAR images

Google Earth Engine ROI area falling outside/partial coverage by Sentinel 1 Tile

But now I would like to calculate the area of inundated areas and export them to CSV file but when running this code, the Error

flooded.multiply is not a function

What can I do ?

var flooded = S1.select("Water")
Map.addLayer(flooded,
 {min:0, max:1, palette: ['grey', 'blue']},
 'flooded')

var areaImage = flooded.multiply(ee.Image.pixelArea())

var area = areaImage.reduceRegion({
  reducer: ee.Reducer.sum(),
  geometry: aoi.geometry(),
  scale: 10,
  maxPixels: 1e10
  })

2 Answers 2

0

Flooded is still an imageCollection so you have to select 1 image out that collection:

var areaImage = flooded.first().multiply(ee.Image.pixelArea())
var area = areaImage.reduceRegion({
  reducer: ee.Reducer.sum(),
  geometry: aoi.geometry(),
  scale: 10,
  maxPixels: 1e10
  })

In this example I selected the first image with first(), but you can also select different images. I can highly recommend doing some tutorials which cover these basic differences between images and imageCollections: https://developers.google.com/earth-engine/tutorials/tutorials

2
  • thank you very much for your response but i would like to calculate the area of imagecollection (timeseries). I click the link but i feel confused because it has many tutorials and i don't know what to do. Could you give some specific information? Thanks you in advance
    – xanthi
    Commented Mar 31, 2022 at 9:05
  • Your question was related to resolving the error, which is resolved here. You are now asking something different, which I believe requires you to go through some of the basics of GEE, so probably start at the beginning (in the tutorials). Ultimately you are going to want to build a .mapped() function that iterates over the collection and calculates the area at each step: developers.google.com/earth-engine/guides/ic_mapping
    – Jobbo90
    Commented Mar 31, 2022 at 9:12
0
var flooded = S1.select("Water")
var areaImage = flooded.multiply(ee.Image.pixelArea())

var area3 = areaImage.reduceRegion({
  reducer: ee.Reducer.sum(),
  geometry:  aoi.geometry(),,
  scale: 10,
  maxPixels: 1e10
  })

var flooded_area3 = ee.Number(area3.get('classification')).divide(10000).round();
1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Oct 5, 2022 at 15:33

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.