Giter Site home page Giter Site logo

Results not as expected about centerline HOT 7 CLOSED

fitodic avatar fitodic commented on July 28, 2024
Results not as expected

from centerline.

Comments (7)

AHomoudi avatar AHomoudi commented on July 28, 2024 1

@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 :

  1. Chaikin's corner-cutting algorithm with refinements degree of X0
  2. Shapely simplify function with a tolerance of X1
  3. Centerline function with interpolation distance X2

X0, X1, X2 values depend mainly on details of the work and desired results.

from centerline.

fitodic avatar fitodic commented on July 28, 2024

From what I can see, this polygon data set is very detailed. Nevertheless, there are several options you can look into:

  1. Modify the border density parameter (by default it is set to 0.5 meters)
  2. Simplify the polygon data set (e.g. QGIS)
  3. Simplify the centerline data set (e.g. QGIS)

from centerline.

feihugis avatar feihugis commented on July 28, 2024

@fitodic Thanks for your suggestion! The results got much better by simplifying the polygon data using Shapely simplify function.

from centerline.

fitodic avatar fitodic commented on July 28, 2024

Glad I could help 🙂

from centerline.

AHomoudi avatar AHomoudi commented on July 28, 2024

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?

image

EDIT: simplifying centerline data set does not remove extra lines at the ends.

from centerline.

fitodic avatar fitodic commented on July 28, 2024

@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.

fitodic avatar fitodic commented on July 28, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.