[GRASS-user] Centerlines of Polygons (skeletons)

Hamish hamish_b at yahoo.com
Thu Jun 19 07:22:00 EDT 2008


Mars wrote:
> Wondering if there is a simple way in GRASS to produce skeletons
> of Polygons (rivers/streams), to find the flow centerline.

Michael Perdue 
> You could do;
> 
> v.to.rast -> r.thin -> r.to.vect -> v.clean (and
> maybe v.generalize)
> 
> But you'll lose the link to the attribute data.


see also this example in the r.watershed help page: "Create a more detailed stream map using the accumulation map and convert it to a vector output map."


Another take on the r.thin approach is to use r.cost from the river bank to get a layer with distance to shore. Then feed that through r.param.scale feature method to extract "ridge lines" of the cost, and then run r.thin on that.


a problem is that for a long narrow river to get accurate results the raster resolution must be very fine, which makes the overall map size unmanageable. I had an idea to write a script which would iteratively make its way downstream doing {v.to.rast, r.cost, r.thin, r.to.vect line} then merging the vector lines somehow but have not gotten around to it, hoping there was a more elegant solution from fluvial gurus.

The problem of what to do at forks requires some thought as well.


One project we have here requires the establishment of a river-mile linear referencing system (LRS), i.e. a custom coordinate system where our axes are river-mile and +/- perpendicular offset. (like v.segment or v.lrs.segment)

then we can "straighten the river" and do our theoretical work in a simpler 2D model versus putting it in a full triangulated mesh.
maybe a third axis could be deviation angle or radius of curvature at that point in the LRS. Maybe better to just store that as a regular attribute of the LRS node (created with v.[lrs.]segment or 'v.to.points -i dmax=').


In another project I require to know the width of the river at any point along it (for fluid dynamics calcs). Again I had hoped to use a line perpendicular to an established centerline LRS, chop at intersection with the riverbank polygon, then upload the line length as an attribute of the LRS node. From there to get a raster layer I could either write the line with r.in.poly using the value or r.grow the converted LRS node data.
Or grow outwards 2*max distance from riverbank given by r.cost.


I have read through Bill's paper a few times but fear I lack the ArcInfo experience to understand the methods well enough to port it to GRASS vector functions, although I am sure it is possible to do so.

Another gotcha is that for the first project we would like to, in general, try and follow the center of the channel, ie the fastest part of the flow and not cut inside corners too much (getting back to Mars's original request). I am not sure if it is better to follow the geometric centerline or primary flow streamline at sharp bends; maybe best to include a switch to let the user choose which is the more appropriate.

It seems like a least-bending-energy thin-"snake"-spline run through the middle of the river polygon might be another nice solution.



happy for ideas,

Hamish


ps- note new mailing list address.



      



More information about the grass-user mailing list