I have a working script that calculates the number of times a 30 m pixel intersects with a polygon feature in a
ee.FeatureCollection. The input data is a 30 m raster for the entire mainland SE Asian region and a polygon layer. To generate the number of polygon counts per pixel, I create an Image Collection where each image corresponds to a raster with values of '1' for each pixel within a single polygon feature, and after ensuring that all the images share the same image footprint, I sum all the values in the
The script works (link here; I shared the assets too), and I have managed to get the result for Cambodia, which was an image of size 10 Mb.
However, this task had a runtime of 2 days (and was attempted 2 times, as shown in the task details). I am afraid that this waiting time is too long for me, as I need to repeat this process for the other four countries of mainland SE Asia and also six more times for six more years (currently the script is running only for the year 2012).
My hunch is that the bottleneck is in the
Export.toImage task, as it is a client-side function. How do I speed up this process? I already ensured that I used
.map() instead of a for-loop. Can anyone suggest modifications to the code? Or should I reach out to Google Earth Engine to request for additional computational power since this may be a heavy geoprocessing task?
Please see below a screenshot of the GEE profiler.