fitodic / centerline

Calculate the polygon's centerline
https://centerline.readthedocs.io
MIT License
266 stars 55 forks source link

Centerlines have "skeleton" like elements #31

Closed grndng closed 2 years ago

grndng commented 2 years ago

Hey there,

when I run the centerline method on a rather simple, rectangular Polygon, I unforunately get not only one but several hundred or even thousand LineString objects grouped together as a MultiLineString object. At least with shapely I haven't been able to a) merge, union or dissolve the objects to receive a single LineString or b) split a Polygon with the LineString I'm trying to create.

The bigger problem, however, is that I'm not getting a clean, straight line as shown in the example but a skeleton-like LineString. I'm attaching an image of the Polygon and the LineString I'm getting by running Centerline(my_polygon).

grafik grafik

Looking at my result I wonder whether I'm doing something wrong?

ZKL-VOILET commented 2 years ago

I have the same problem, have you solved it?

AloshkaD commented 2 years ago

Exact same issue here. For example a very simple rectangle poly POLYGON ((3566.87 4690.537, 3736.966 4690.537, 3654.495 15.463, 3489.553 10.309, 3566.87 4690.537)) gives thousands of coordinates of MULTILINESTRING ((3511.536846846467 32.61758209752352, 3511.206142601772 32.28447243294296), (3511.051979175112 32.12549654544849, 3511.206142601772 32.28447243294296),........... Literally 20 pages of coordinate. Something isn't right

grndng commented 2 years ago

I have the same problem, have you solved it?

I don't have any real solution. However, the "extensions" are leftovers of the tesellation if that helps. I was working on a proof of concept kind of thing that got stuck due to multiple other reasons so I've stopped using centerlines altogether. Sorry!

fitodic commented 2 years ago

There's no way around it (that I'm aware of) other than adjusting the density parameter and trimming the excess branches.