I get this error (Script Error, File too large: larger than 512kb) in Google Earth Engine and my layer is a Multypolygon, just with 86 polygons. I have another layer with 300 polygons without any problem, and I noticed that it's a GeometryCollection (Type), but I don't Know how it changes. Do you know how can I do that?

script error


In Earth Engine's geometry model, something being called a GeometryCollection rather than MultiPolygon just means that some of the geometries are not polygons (they could be lines or points). You cannot cause a GeometryCollection to be made out of polygons except by unioning them with a non-polygon geometry.

However, there is no reason to do this — geometry collections are not processed more efficiently if they are non-uniform.

(I'm referring to geometries being processed within Earth Engine only. Of course, external formats — including the GeoJSON that EE's geometry I/O is based on — allow writing a container more general than necessary; I'm saying that this doesn't matter once the geometry is loaded, and the answer you get will always be based on the actual contents, not what was loaded.)

For your problem, you should consider storing your complex geometry as an asset instead of a script import. This will have much better performance and larger size limits. (The disadvantage is that you cannot edit it interactively.)

  • GeometryCollection can contain different types of geometries, but it does not need to do so. GEOMETRYCOLLECTION ( POINT ( 1 2 )) is a perfectly valid GeometryCollection.
    – user30184
    Mar 8 '21 at 8:08
  • @user30184 I'm referring only to Earth Engine-internal geometries. Certainly whatever format you're quoting, and the GeoJSON that EE built its model on top of, allows writing such a collection, but EE will not process it differently.
    – Kevin Reid
    Mar 8 '21 at 15:25
  • Before you edited the answer it seemed to mean GeometryCollections generally. The whatever format I was quoting is the "OpenGIS® Implementation Standard for Geographic information - Simple feature access - Part 1: Common architecture" that defined GeometryCollection "A GeometryCollection is a geometric object that is a collection of some number of geometric objects."
    – user30184
    Mar 8 '21 at 15:47
  • @user30184 Yes, I edited to clarify the scope of my answer. Are you claiming that it needs further clarification, or that my answer implies Earth Engine is incompatible with said standard in some way, or something else?
    – Kevin Reid
    Mar 8 '21 at 15:58
  • I think your answer is pretty perfect and makes clear that the idea that OP had about expressing MultiPolygons as GeometryCollection would not solve the issue. I apologize that I interpreted that you meant "You cannot cause a GeometryCollection to be made out of polygons except by unioning them with a non-polygon geometry" to apply to all programs, not just GEE.
    – user30184
    Mar 8 '21 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.