troutspotr / troutspotr-frontend

Help anglers make safe and legal choices when fishing for trout.
Other
6 stars 2 forks source link

Solve the Yampa river problem #165

Closed andest01 closed 5 years ago

andest01 commented 5 years ago

Yampa River, Colorado

image

The Yampa river has a problem; currently, it's about 206 subsections as trout-stream sections, which is far too high. We need a way to dissolve them into smaller parts.

This is what those 206 parts look like overlapping each other. image

andest01 commented 5 years ago

This is becoming a maddeningly difficult problem to solve due to the limitations of floating point numbers. ST_Union struggles to collapse and simplify "intersecting" lines that overlap yet don't share vertices, relying on the limits of floating point numbers to determine equality.

https://gis.stackexchange.com/questions/305481/postgis-st-linemerge-why-do-3-lines-not-merge-but-any-2-do

andest01 commented 5 years ago

this problem sucks and i don't feel like solving it anymore. For each state, I'll just st_union(st_buffer(geom, 0.00000000001, 'butt')) the trout section lines and snap to the closest vertext of the underlying river, THEN i'll collapse them via ST_Union + ST_Linemerge. Whatever. It's not worth being perfect upstream if the upstream is gumming up the entire works.