WikiWatershed / rapid-watershed-delineation

Rapid Watershed Delineation Code for MMW2
Apache License 2.0
12 stars 6 forks source link

Convert watersheds to GeoJSON ahead of time #69

Open kdeloach opened 7 years ago

kdeloach commented 7 years ago

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

  1. Convert subwatersheds to GeoJSON and upload to S3
  2. Modify RWD to return subwatershed IDs instead of a shapefile
  3. Load subwatershed features from S3 client-side
  4. Merge features client-side using turf(?)

Questions

  1. Is the output from RWD always the dissolved result of 1 or more static subwatersheds?
  2. Are subwatersheds used in any calculations, or do they exist purely to generate output?
  3. 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.