[postgis-users] How to get the centerline of a polygon?
Stephen Woodbridge
woodbri at swoodbridge.com
Fri Jan 18 07:11:27 PST 2008
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
More information about the postgis-users
mailing list