Angle between lines


This Python script calculates the angles formed by crossing lines in two different line shapefiles. The result consist in a point shapefile storing the angle between crossing lines, together with the identifiers of the lines involved.
Below you see an example of resulting angles between two line layers.

Angles are calculated by considering a circular buffer centered on line crossing, with radius equal to the value chosen by the user. By incrementing this value, a less local result is obtained.


Version: 2010-03-13
Language: Python 2.6
Required modules: ogr, sys, os
Created and tested with: FWTools
Developed with M. Radivojevic for the processing of Antarctic megadune traces.

Working within the FWTools shell, an example command line is:
     python lineshape1 lineshape2 outputshape distance
where lineshape1 and lineshape2 are the names of the two input line shapefiles, outputpointshape is the name of the output point shapefile and distance is the circle radius for the calculation of the angle.

This algorithm is available also through a web application. Requires the uploading of two shapefiles, compressed into a single zipped file. The result, consisting in a zipped shapefile, can be downloaded.

Program input

Two line shapefiles and the circle radius.

Program output

A point shapefile storing crossing locations, with corresponding lines and the identifiers of the two lines involved.


Mauro Alberti