0

Using the Google Earth Engine API, I have created a feature collection asset that should be accessible at this link: https://code.earthengine.google.com/?asset=users/nakoaf/example_fc

I have been unable to export the asset and receive the error:

Error: Collection contains a degenerate geometry. (Error code: 3)

The asset should already be filtered to only include polygon geometries. I have tried to filter it to ensure that this is the case but the filtered feature collection returns the same error when I attempt the following:

Export.table.toDrive({
    collection: example_fc,
    description:'example_fc',
    fileFormat: 'SHP'
})

I have also successfully filtered the feature collection to only include features with areas greater than 0.001 hectares (10 square meters) to avoid including any degenerate, zero area polygon geometries. I was filtering based on the 'areaHa' property of the asset. While the filtering is successful, the export still fails with the same error indicating a degenerate geometry.

How can I export this table to my drive as a shapefile?

1
  • Your approach feels good to me. If feature has an area it cannot be a line or a point. I wonder if the error message could be inaccurate and some feature has some other issue. What might happen if one part of a multipolygon is degenerated, or a hole in a polygon has been changed into a line?
    – user30184
    Jan 12, 2023 at 7:44

2 Answers 2

0

I tried to use a coarser area filter on the 'areaHa' property by filtering only for polygons with areas larger than 0.1 hectares and that resulted in a successful export of the table to Drive as a shapefile. While this is a fine temporary fix, I would love to know if anyone can come up with a more sophisticated solution to filter out the degenerate geometries. The solution I've arrived at only include geometries with areas larger than 1000 square meters. Filtering for geometries as small as 100 square meters still results in some degenerate geometries.

I essentially want to filter out the degenerate geometries without using such a coarse size filter that likely removes some useful geometries as well.

1
  • 1
    As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Jan 12, 2023 at 7:16
0

You have a bunch of 0-point Multiploygons in your collection. You can filter those out with something like this:

fc = fc.map(function(f) {
  var count = f.geometry().coordinates().size()
  return ee.Algorithms.If(count, f, null)
}, true)
1
  • Thank you, Noel, for identifying the 0-point Multipolygons. I have tried to filter those out with your suggested code, but the degerenate polygons are still there for now. I'll keep working to fix this and will let you know I'm successful. In the mean time, I appreciate any suggestions from you or anyone else
    – Nakoa F
    Jan 17, 2023 at 15:56

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.