Code Monkey home page Code Monkey logo

label_centerlines's Introduction

create centerlines

This script reads polygon datasets such as i.e. the geographic regions from Natural Earth and extracts smoothed centerlines for better label placement. This method is used to create the label layer of EOX Maps

To do so, it basically creates a Voronoi diagram to get the polygon skeleton. Finally, the centerline is selected and smoothed.

process steps animation

Steps:

  1. Extract outline.
  2. Segmentize outline to get more evenly distributed outline points.
  3. Extract points.
  4. If there are too many points, simplify the segmentized outline and Extract points again.
  5. Create Voronoi diagram.
  6. Select all Voronoi edges which are inside the source polygon.
  7. Determine the best line.
  8. Smooth line.

Basic usage:

create_centerlines.py <input_file> <output_file>

Parameters:

  • --segmentize: maximum length of line segment (default 0.5)
  • --max_points: maximum number of points allowed before generating the Voronoi diagram (huge influence on performance) (default 3000)
  • --simplification: stepwise simplification value until geometry has less than maximum number of points allowed (default 0.05)
  • --smooth: degree of smoothing to be applied to the final centerline (default 5)

label_centerlines's People

Contributors

ungarj avatar

Watchers

James Cloos avatar Erica Fischer avatar  avatar

Forkers

fagan2888

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.