sgrieve / sinuosity

Script to calculate sinuosity of a polyline shapefile

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sinuosity

DOI

The following code needs fiona and shapely installed, using either pip or conda, and expects a shapefile containing a single polyline.

It works by creating two shapely LineStrings and then using their length attribute to calculate sinuosity.

If you are using a geographic coordinate system, you will need to calculate great circle distances. To do this I usually use pyproj's geod.inv method.

Usage

Run the script with a shapefile filename as follows:

python sinuosity.py myline.shp

This will calculate the sinuosity of the line stored in myline.shp and output the result to the screen.

Install

This code used shapely and fiona which can both be pip installed using:

pip install -r requirements.txt

Licence

This code is MIT Licensed, see LICENCE.txt for details.

Citing

If you would like to cite this script, you can grab the bibtex file here.

About

Script to calculate sinuosity of a polyline shapefile

License:MIT License


Languages

Language:Python 100.0%