[Talk-us] What to do with unnamed NHD streams
mike at teczno.com
Tue Oct 30 05:38:49 GMT 2012
On Oct 29, 2012, at 12:49 AM, Paul Norman wrote:
>>>> There are ways around this, by first de-duping the shared edges or
>>>> nodes. Topology preservation is not terribly difficult if you prepare
>>>> your data, for example by splitting lines and polygons at
>>>> intersections (as in your lake example), simplifying only the parts
>>>> and then reconstructing the original geometries.
>>> Do you have a link to an example of the PostGIS magic to do this? It's
>>> beyond what I could do.
>> I implemented a version of this here:
>> Without digging into the code too deeply, the short version is that you
>> can use the intersection of two shapes to arrive at something like a
>> topology. For a pair of polygons that share a border, the
>> ST_Intersection() results in a linestring that forms the border, which
>> you can ST_Difference from each border to get the remaining pieces. The
>> expensive part is the gigantic pairwise comparison to come up with the
>> full list of all feature pairs that touch each other or come really
> I'll have a look tomorrow - I'm too tired to give it thought right now.
This is a rough sketch for how the process could work on the NHD Areas file:
It's fairly primitive, but the general idea is there. First I converted to an Albers projection, then snapped all the geometries to a 1-meter grid. Each polygon is looked at in turn, with all the joined streams used as a locations along the point path to create anchors for the simplification process. I'm not catching enough edge & corner cases for this to really work, yet, but the lines simplify down astonishingly well.
A likely better way to do this would be to more aggressively convert the NHD into a truly topological dataset, simplify *that*, and then reform all the polygons.
michal migurski- contact info and pgp key:
More information about the Talk-us