qgSurf: a Python program for the interactive determination of intersections between DEM and planes


In structural geology and geomorphological analyses, we could be interested in determining the topographic traces of geological surfaces based on their orientations, for instance estimated at some structural sites. If we have a DEM available, how is it possible to determine the topographic intersections of a specific plane, characterized by the values of the dip direction and dip angle?
A Python application, together with a Quantum GIS plugin, that allow to calculate the DEM/plane intersections are here presented. The Quantum GIS plugin can be installed from the plugin installer of Quantum GIS: check for the qgSurf plugin.


Quantum GIS plugin

Current version: 0.1.3 - October, 7 2012, third release

You can directly install the 'qgSurf' plugin from the Quantum GIS plugin manager.
Otherwise, you can download it from the Quantum GIS Plugin Repository, unzip and put the 'qgSurf' folder in the Quantum GIS Python plugin folder.
Tested in Quantum GIS 1.8.0 - Ubuntu 12.04 and Windows Vista.

Do you want to contribute to the development of this application?

Stand-alone Python module

Current version: 0.1.2 - June, 24 2012, third release

GitHub: gSurf
zipped files: gSurf_0.1.2.zip

File to run the application: gSurf.pyw.
Implemented in Python 2.7.2 with Eclipse/PyDev and Qt Designer. Tested in Windows Vista (Python 2.7.2) and Ubuntu Lucid Lynx (Python 2.6.5). Requires:

GUI (QGIS plugin)

I describe the main functionalities in the QGIS plugin case. See the figure below for number references.

Definition of input DEM, DEM colomap and of an optional linear shapefile (e.g., fault traces). Control of their visibility.

2 and 6
Definition of the "source point" location (i.e., a point that lies in the plane to be created). The button in 6 (symbol: red circle) allows to define the source point in the map. The elevation can be constrained to equal the local DEM elevation (option: 'fix to DEM').

Definition of the geological plane orientation, expressed by its dip direction and dip angle.

Intersection visibility, color and calculation.

Definition of output shapefile (with line or point geometry).

Navigation toolbar that allows to zoom, pan, save the map as an image, and also to set the source point location in the map (red circle).

The map visualization area with the calculated intersections (white).

Methodology and case study

The theoretical basis of the algorithm are described in the post: Intersezioni tra DEM e superfici planari, un tema di interesse in geologia. A case study is presented in: gSurf: una applicazione Python per calcolare interattivamente l'intersezione fra piani e DEM.

Changes in vers. 0.1.3

Fixed bugs

  • - save of x, y and z fields for point output;
  • - manage display of lineament vector layer when not defined.

Changes in vers. 0.1.2

Add function to save the intersections also as lines (experimental function)

Improved GUI code (QGIS plugin mainly)

Changes in vers. 0.1.1

Improvements in the GUI, especially for the Linux version.

Fixed bugs

  • - Managed 'divide-by-zero' cases for intersection calculations, when dipping or inclination of the plane are equal to 0.
  • - Corrected definition of extent area when the DEM extension did not load immediately.
  • - 'Point source', managed problem with double click on the 'red circle' tool, that made it always active.


My name is Mauro Alberti. I'm a freelance 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


Mauro Alberti


mobile: +39 338 8022247
skype: mauro.alberti.siena
Address: Strada per Casale 56,
Verolengo (TO) 10038, Italy

P.I. 01292740527