This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Roads, rivers and similar linear structures are often represented by long and complex polygons. Since one of the most important attributes of a linear structure is its length, extracting that attribute from a polygon can prove to be more or less difficult.

Installation:

You can download the package from PyPI:

$ pip install centerline

Warning: This package has several dependencies, including Numpy, Scipy and GDAL/OGR. If you are installing these packages in the virtual environement, make sure you have all the necessary dependencies on your system. Furthermore, after installing GDAL locate the GDAL headers:

$ whereis gdal
gdal: /usr/include/gdal /usr/share/gdal

and set the include path using the following environment variables:

$ export CPLUS_INCLUDE_PATH=/usr/include/gdal/
$ export C_INCLUDE_PATH=/usr/include/gdal/

After that, you can proceed to installing GDAL in the virtual environment. For more info, visit Stack Exchange.

Usage:

If you are planning on using this package inside of your own code, just type:

>>> from centerline import Centerline

However, if you just want to convert a Shapefile full of polygons into a Shapefile full of centerlines, use the command line tool:

$ shp2centerline INPUT_PATH.shp OUTPUT_PATH.shp [BORDER_DENSITY]

The BORDER_DENSITY parameter is optional. If not specified, the default value is 0.5.

Warning: The INPUT_PATH.shp file needs to have a column called id with unique values or the script will fail to execute successfully.

References:

Notes: When defining the density factor, one has to take into account the coordinate system defined in the Shapefile. The script was designed to handle metric coordinate systems, so the density factor is by default 0.5 (meters). For instance, if the value is set to 0.5 m, it basically places additional points on the border at the distance of 0.5 m from each other. If the user doesn’t define the value (see Usage), the script uses the default value. If the value is a negative number, it will be converted into a positive number.

It appears that the Voronoi function available in the SciPy module does not handle large coordinates very well. Since most of the coordinates are large numbers, a bounding box is needed to determine the minimal X and Y coordinates, i.e. the bottom left corner of the bounding box. These values are then used for coordinate reduction. Once the Voronoi diagram is created the coordinates are returned to their non-reduced form before creating LineStrings.

Example

Release History

Release History

0.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
centerline-0.1.tar.gz (124.1 kB) Copy SHA256 Checksum SHA256 Source Jan 15, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting