This application was developed as an unofficial personal project and allows a user to trace stormwater flow within LA County storm drain networks. Flow can be traced upstream or downstream, and when tracing upstream custom generated subwatershed basins can be used to identify parcels which may be contributing water or pollutants to the storm drain system. Flow can be blocked in the trace process to exclude certain network nodes from the analysis. These results, excluding parcels and subwatersheds, can be exported as an CSV or as GeoJSON files.
This application uses the ArcGIS API for Javascript for client-side mapping and results handling and uses the Esri Caclite Design System for UI elements. Server-side processing occurs on a Python Flask server which generates and exectues SQL commands to a Postgres/PostGIS database.
LA County's storm drain data, which includes data within many cities, were downloaded from here and edited by splitting such that polyline feature's start and end points did not intersect midline, all line end points must either end at a point feature or the start of another line feature. While the source data has outlets for the system, many gravity mains were shown as ending without outlets, in these cases pseudo outlets were derived. Source data were also snapped such that nearby, ~5ft of each other, features were correctly coincident. Finally, all line feature geometries and IDs were combined into a single network table that was noded using pgrRouting's pgr_createTopology.
The network is traced by the Flask server which uses the user's input to write dynamic SQL queries. The primary query for tracing uses the pgr_drivingDistance algorithm to find all edges and nodes in the provided trace direction. The results, which are given for the noded table and node vertices datasets, are then used to select and union the assiocated results from the primary storm drain datasets, which store all the attribute information. These results are returned to Flask in GeojSON format where they are further formatted and returned to the requesting client. If the filter parcels option was selected, then all subwatersheds which intersect the inlets are selected then the subwatershed geometries are used to query LA County's parcel MapServer REST API to get the OIDs of all intersecting parcels. These OIDs are attached to the Flask server response to be processed on the client-side.