2

I am using the GSW seasonality raster in GEE. I started by clipping the GSW to the whole South America region and masked this region only. However, I do not manage to export to GDrive and I get the error:

User memory limit exceeded

Here is the code:

//South America polygon
SA_poly = ee.FeatureCollection("South_America_polygon");

//GSW 1.1 with seasonality and clip to South America shoreline
var seasonality = ee.Image("JRC/GSW1_1/GlobalSurfaceWater")
                   .select('seasonality').clip(SA_poly); 

//export to drive
Export.image.toDrive({
  image: seasonality,
  description: 'seasonality',
  scale: 30,
 folder: 'GEE',
  fileFormat: 'GeoTIFF',
  region: SA_poly,
  crs: 'EPSG:4326',
  skipEmptyTiles: true,
});

Is there a way to overcome that? Create a split polygon function of the export polygon to a size that would allow GEE export?

2 Answers 2

2

Yes, you can export dataset as individual tiles with a couple of custom tricks, but in your case I'd recommend using original export-ready tiled dataset.

1
  • Thank you for the answer. That is indeed a solution. However, I am hoping to apply some masks on the GSW raster using the GEE code editor and I’d like to be able to export the results of the global raster. Is that possible?
    – Cristian
    Commented Feb 23, 2020 at 17:02
2

User memory limit exceeded

Most likely is the result of using .clip() with a feature collection. You may have success using .clipToCollection(), instead.

API reference states: "Use clipToCollection to clip an image to a FeatureCollection."

You can also try to simplify the features in the feature collection to match the resolution of the dataset you are exporting, which will reduce the memory required to process the request if the original feature collection has precision that is less than 30m. Use the resulting feature collection to clip the raster data.

SA_poly = SA_poly.map(function(feature) {
  return feature.simplify(30);
});

You can increase the maxError (~resolution) value as needed to complete the job, acknowledging that the shoreline will be less precise than the resolution of the data you are exporting.

4
  • I have changed the code to include now .clipToCollection() and I get the same error
    – Cristian
    Commented Feb 23, 2020 at 17:35
  • I still believe the problem is with the clipping by the feature collection step. There are too many vertices over too many tiles to handle in memory. I added one more thing to my answer that you could try - simplify the features in the feature collection to reduce the memory needed. Commented Feb 24, 2020 at 16:41
  • I have solved it by avoiding the geometry. You were right, too many vertices to handle. I used instead a raster of SA_poly as the region in export and set maxPixels value form the warning I got at initial export try. I was amazed to see that in 35 min the whole South America raster was exported. All data is fine.
    – Cristian
    Commented Feb 27, 2020 at 14:40
  • Nice workaround - glad you got it working! Commented Feb 27, 2020 at 16:26

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.