How to create project for a watershed, knowing its USGS HUC code

It’s possible, but maybe not performative. Polygon queries in the database (PostGIS) are generally too slow for us to support (fine when you have a couple thousand records and a few simultaneous connections, not fine with you have a couple million records and a lot of simultaneous connections). Polygon queries in our search index are doable, but I think we’d have to do some thorough testing of the performance implications, and I’m pretty sure precision would be an issue (i.e. the boundaries of the polygon would be considered to be a bit fuzzy). Currently queries for observations in places work by storing the IDs of all the places that contain the obs coordinates in the search index (“what polygons contain this point” is a pretty fast database operation) and then when you ask for “observations in Moldova” or something, we pull all the observations that were indexed with the place ID of Moldova, which is very fast, since there are no geometric operations being performed. The performance problems that come with this approach are that every time you add, delete, or change a place boundary, we need to re-index all the observations that were in the old boundary and all the ones that are in the new one, which takes a long time if that place is Texas. Actually performing a geometric operation in the search index would mean less index churn, but probably slower queries.

1 Like