If you could break your rope into a series of smaller polygons such that each new polygon has two opposite edges that are from the original polygon, you could take the centroids of all these points and create a linestring. If you could make these polygons infinitely small, you'd have the "true" center line I think.
Still begs the question of how to cut up the big polygon, but perhaps more doable in the end. -Mark On Jan 18, 2008 9:54 AM, Eric Yu <[EMAIL PROTECTED]> wrote: > Thanks for your comments. The questions you asked are exactly what I faced > while I was searching for answers. It is easy to draw a centerline by human, > but I don't even know where to start. My initial idea was like this: > > (Imagine we have a polygon, shaped like a rope, lying on the plane) > 1. First we need to find the two ends of the rope > 2. From the two "central points" of the two ends (if we can determine), > we can split the exterior ring of the rope into two line strings. > 3. Along the two line strings, we can locate the points at 0.01, 0.02, 0.03, > ... > with this method, maybe we can ignore the unmatched points on the two > edges. > > However, the first step is hard (just as what you said about where to > "start" and "end"). > I can't figure out a good way to do this. > > In fact, the problem comes from here: I have a highway road network > (up/down line, > and ramp branching off, etc.) and I need to draw a simplified line > following the road. > So I first use ST_Buffer() and then union the buffers into a > rope-shaped polygon. > And there comes the centerline problem. > > Maybe there is some other way to achieve this? > > Thanks! > > Eric > > > On Jan 18, 2008 11:11 PM, Stephen Woodbridge <[EMAIL PROTECTED]> wrote: > > > > Eric Yu wrote: > > > Hi, > > > > > > Suppose I have a long shaped polygon, like river area or the road, > > > is it possible to get the centerline of the area using PostGIS? > > > Or with other GIS library/software? I searched and tried but failed to > > > get any solution. > > > > I think the problem to start with is how are you going to define what > > the center line of the polygon in algorithmic terms? Does the center > > line change if you rotate it 90 degrees? Assuming you had a center line > > of a polygon, how would the points of the centerline relate to the polygon. > > > > I assume you want some set of points that approximates a path between > > the two adjacent polygon virtual "edges", but polygons are made of > > multiple points and hence multiple edges so what points belong to which > > "edge". Also if the number of points does not match on the opposite > > "edge" how should that be handled? How does one determine what points > > belong to the "start" and "end" "edge of the polygon that the center > > line needs to "start" on and "end" on? > > > > If you can answer these questions clearly then it is possible to write > > an algorithm to do what you want. But just looking at the polygon and > > intuiting that there should be a centerline that follows some visual > > path the your mind perceives is kind of hard to deal with. > > > > -Steve W > _______________________________________________ > postgis-users mailing list > [email protected] > http://postgis.refractions.net/mailman/listinfo/postgis-users > _______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users
