0

I want to perform an unsupervised classification on a feature collection that has many small geometries. I know it will create problems for GEE to work on such many small geometries but I cannot find a way around it. I have to consider only this geometry because I know there are only 3 kinds of forests in this area and I can choose 3 classes for my classification, so I cannot consider the whole area.

I have tried things like simplify({maxError: 100} and performing an intersection, but I got the error for any layer I try to map :

MEAN_Summer_IC: Layer error: Collection.geometry: Geometry has too many edges (2739216 > 2000000)

Can I work with the asset 'Plot'? https://code.earthengine.google.com/d3da6db88b9d9fcc689519525024d941

4
  • Hi, could you make your asset ForestPlantation public so that other users can run the code? Currently it's not available.
    – M. Nicolas
    Apr 19, 2022 at 15:16
  • FYI, not a complete answer: you ask about many small geometries, but the error you are getting is because something in your script is converting them into one large geometry. That's what you need to avoid.
    – Kevin Reid
    Apr 19, 2022 at 16:25
  • @M.Nicolas Thanks Nicholas. I made it public now. Sorry for the inconvenience.
    – Paris
    Apr 19, 2022 at 17:55
  • @KevinReid thanks, Yes it actaully one very large polygone with many edges. A shapefile of classified land cover class
    – Paris
    Apr 19, 2022 at 17:56

1 Answer 1

0

I see several ways in which your code can be optimized relative to Plot so that it'll run without problems.

  • First, and very importantly, you must avoid clipping images (and especially imageCollections) unless strictly necessary. When doing .map(function(image){return image.clip(Plot)}); you are increasing computation time and memory. Read more on this here. Instead, filterBounds() (which you are already using) or clipToCollection() are good alternatives, though you may need to use Plot.union() when using filterBounds() instead of just using Plot, not sure this is best practice though.
  • Second, generally speaking, if you are struggling to simplify your geometry in GEE, you can use QGIS instead and then re-upload your asset, though this might not be necessary.
  • Finally, aside from filtering the bounds of your imageCollection, I see no reason why you need to use Plot; if in the future you need to get results for that area specifically (e.g. a mean NDVI value), you will need to use reduceRegion but do check out how to use it in the case of complex geometries.

Overall, I suggest you read through Coding Best Practices, since they adress many of the issues you have here.

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.