Angle between lines

Aim

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.


Implementation

Version: 2010-03-13
Source: lineorientation_07.py
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 lineorientation_07.py 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.

About

My name is Mauro Alberti. I'm a Gis and scientific programmer. My primary specializations are in scientific and GIS programming (OS tools, mainly Python, R, Fortran and C++), Earth Sciences (structural geology, Polar Sciences), geostatistical analysis. About me

Contact

Mauro Alberti

alberti.m65@gmail.com

mobile: +39 338 8022247
skype: mauro.alberti.siena
Address: Via Canonica 32,
Milano (MI) 20100, Italy

P.I. 01292740527