The biggest performance bottleneck of the RWD API is converting watersheds to GeoJSON. By converting subwatersheds to GeoJSON ahead of time, we can skip the most time consuming part of the watershed delineation process.
Instead of merging 1 or more subwatersheds into a single shapefile, and serializing that-- we could pass subwatershed IDs to the client, fetch the precomputed GeoJSON files there, and merge them client-side.
Plan
Convert subwatersheds to GeoJSON and upload to S3
Modify RWD to return subwatershed IDs instead of a shapefile
Load subwatershed features from S3 client-side
Merge features client-side using turf(?)
Questions
Is the output from RWD always the dissolved result of 1 or more static subwatersheds?
Are subwatersheds used in any calculations, or do they exist purely to generate output?
Are the Main_Watershed files used in the output?
Notes
This doesn't change our strategy to simplify shapes since there is still a speed vs. size trade off to consider.
Since we don't need to produce a shapefile from dissolving subwatersheds, we may be able to eliminate the subwatershed shapefiles from our Worker instances which may result in less disk space usage.
Someone with greater RWD knowledge would have to decide how feasible this is.
Overview
The biggest performance bottleneck of the RWD API is converting watersheds to GeoJSON. By converting subwatersheds to GeoJSON ahead of time, we can skip the most time consuming part of the watershed delineation process.
Instead of merging 1 or more subwatersheds into a single shapefile, and serializing that-- we could pass subwatershed IDs to the client, fetch the precomputed GeoJSON files there, and merge them client-side.
Plan
Questions
Notes
This doesn't change our strategy to simplify shapes since there is still a speed vs. size trade off to consider.
Since we don't need to produce a shapefile from dissolving subwatersheds, we may be able to eliminate the subwatershed shapefiles from our Worker instances which may result in less disk space usage.
Someone with greater RWD knowledge would have to decide how feasible this is.