Comments (7)
@fitodic Hello:)
Thanks for the helpful tips. Since am doing programmatically for large set of data, I will leave these steps in case someone will need it :
- Chaikin's corner-cutting algorithm with refinements degree of X0
- Shapely simplify function with a tolerance of X1
- Centerline function with interpolation distance X2
X0, X1, X2 values depend mainly on details of the work and desired results.
from centerline.
From what I can see, this polygon data set is very detailed. Nevertheless, there are several options you can look into:
- Modify the border density parameter (by default it is set to 0.5 meters)
- Simplify the polygon data set (e.g. QGIS)
- Simplify the centerline data set (e.g. QGIS)
from centerline.
@fitodic Thanks for your suggestion! The results got much better by simplifying the polygon data using Shapely simplify function.
from centerline.
Glad I could help 🙂
from centerline.
I'm facing the same issue plus am quite new to Python thus I'm using the function of Centerline inside R. I have tried Shapely simplify function but still have extra lines at the end as shown in the figure. Any ideas for more improvement? Or how to apply the 1 & 3 option?
EDIT: simplifying centerline data set does not remove extra lines at the ends.
from centerline.
@ahmathlete Hi :)
As to option 1, there is a parameter that increases or decreases the density of the input geometry:
>>> from shapely.geometry import Polygon
>>> from centerline.geometry import Centerline
>>> polygon = Polygon([[0, 0], [0, 4], [4, 4], [4, 0]])
>>> attributes = {"id": 1, "name": "polygon", "valid": True}
>>> centerline = Centerline(polygon, interpolation_distance=1.5, **attributes)
You can also pass the same value to the command line script.
As to option 3, you create the centerline dataset (e.g. using the create_centerline
CLI command), open the centerline dataset in QGIS and manually delete the nodes that stick out.
from centerline.
@ahmathlete Thanks for clarifying 🙂
If you're willing, you can always update the documentation with this info. I know it depends on the dataset, but it never hurts to supply an example.
from centerline.
Related Issues (20)
- shp2ceterline issue HOT 1
- Error when MultiLineString degenerates into LineString HOT 3
- fiona.open error HOT 1
- Ubuntu 16.04 install issues HOT 1
- QhullError: QH6214 qhull input error: not enough points(2) to construct initial simplex (need 4 HOT 6
- Initial simplex is flat (facet 1 is coplanar with the interior point) HOT 2
- Problems to create centerline when I have used Multipolygon HOT 3
- Setting custom attributes on geometry objects is deprecated, and will raise an AttributeError in Shapely 2.0
- what is centerline instance ? HOT 2
- Centerlines have "skeleton" like elements HOT 4
- [Question] How to remove /avoid those lines? HOT 1
- ShapelyDeprecationWarning: Iteration over multi-part geometries is deprecated and will be removed in Shapely 2.0
- shapely 2.0.0 issue HOT 2
- TypeError: __new__() got an unexpected keyword argument "XXX" HOT 4
- Can not install version 1.0 HOT 6
- Python 3.7 support HOT 1
- Question about: Reverse caculate width if have centerlines HOT 6
- A ~30 time faster implementation using shaplely 2.0 and Geopandas ? HOT 1
- Ran Into this issue while running - Not enough points to construct initial simplex HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from centerline.