Construction of geological cross sections in QGIS

The Earth’s surface forms the interface between our human view of the world and the geology preserved beneath our feet. Variations in this surface are depicted on maps as contoured elevation data or graduated raster images (with colour scales referenced to elevation magnitude). These elevation models can be combined with geological maps to create a 3-dimensional view (or model) of the subsurface. Establishing this view is often a critical step towards understanding the geometries and relationships of subsurface features such as stratigraphy, faults, intrusions, caves and mineral deposits. It is also hugely beneficial when attempting to relate these features to more philosophical aspects such as Earth structure and geological evolution.

The process of building 3-dimensional models has become increasingly automated through the development of specialized software, complex algorithms and a whole lot of arm-waving. However, the first real step in model building (and a method that has been used since the birth of modern geology) relies on the correlation and projection of surface observations into the unknown using basic geological principles. The term cross section was developed from this process and describes a 2-dimensional interpretation of the geology constructed on a profile that has been extracted along a designated map-traverse. This process represents a crucial brain exercise that not only tests a geologist’s skill, but also provides a clarified view of mapped geological relationships that can appear complex  when interfering with topographical variations.

Traditionally geologists used compasses and protractors while constructing cross sections by hand using media such as paper and mylar. Hopefully these objects are not foreign to all of us, but certainly the contemporary geoscientist is familiar with the operation of GIS (Geographical Information Systems), which have greatly increased the efficiency with which we can visualize our data. Our propensity for operating within the digital realm means that the traditional methods and media for interpretation are obsolete. So it makes sense that we have good techniques for the computer-aided visualization and interpretation of cross-section data.

The following steps provide a basic reference for the creation of a cross section from within QGIS, one of the best open-sourced GIS packages around:


Map production is generally the first step a geoscientist will take to visualize the geological relationships that can be gleaned from the Earth’s surface. Remember that maps are not always accurate and are themselves just a representation of the physical world. Be sure that your data is projected correctly otherwise you will encounter some major problems by the time you get to interpreting the cross section. Within QGIS start with the following:

  • Produce a map including geology, an elevation model (some form of raster that contains elevation data, (e.g. tiff, dem, grd, ers) and all the surface measurements (e.g. Bedding, foliations, faults, jointing) you wish to plot in your cross section.
  • If you have a large map area and a lot of structural measurements it will be important that you make a subset of these data otherwise you will get a section that is overpopulated with meaningless data plotted from outside the area of relevance.
Figure 1. Digital elevation model with contours – these data represent the surface that you will be plotting in your cross section
Fig2_Geological Data
Figure 2. Transparent digital geology with surface elevation data. The location of Cross Section 1 is shown.


The relevance of this section depends on the scale of your cross section and the distribution of surface data on your map. In most cases an even spread of surface data is preferable for geological maps, however, in some large mapping areas it is only practical to collect data along traverses, which are often pre-selected for section building anyway. To make a subset of the data I perform a line buffer. This creates a polygon that will contain all the data you wish to subset and use in your cross section, thus excluding any irrelevant data that will prevent accurate section interpretation:

  • Measure an appropriate distance from your line that will allow the buffer to cover enough of your data for making a subset (e.g. 1000m). The size of the buffer will vary greatly depending on the scale of your mapping, complexity of the geology and density of surface measurements, but this part will be up to you and you may need to have a few attempts with different buffers before you get it just right.
  • To buffer: Vector>Geoprocessing Tools>Buffer(s)
  • Fill the dialogue box, being sure to direct QGIS to the correct input vector (i.e. Your cross section line). If this vector file has more than one shape in it you will need to select the line you wish to buffer prior to accessing the Geoprocessing Tools, then make sure you tick the “Use only selected features” box.
  • Add in your buffer distance and type the file path to your output and go!
Figure 3. Use vector geoprocessing tools to buffer your cross section line an appropriate distance to “catch” the data you want to display in your section
Figure 4. Result of 1000m buffer performed on XS1 shown in yellow. Note the overlap with surface measurements.


Now it’s just a matter of performing a spatial query to extract a subset of data that intersects your buffered cross section polygon:

  • Select your buffered cross section polygon
  • To perform the spatial query: Vector>Spatial Query – this will bring up the dialogue box
    • Select your source features (your surface measurements)
    • Where the feature(s) are within
    • Reference feature(s) of your buffered cross section polygon
  • A list of resultant feature ID’s should appear in a new box alongside your original spatial query selection
  • Next take the results of the query and create a new layer from the list of selected items by clicking the button on the bottom right of the window
Fig5_Spatial Query
Figure 5. Spatial Query performed showing result – only the structures within the yellow buffered cross section polygon are selected. Green points show the newly created layer.


So now you have a reasonable number of surface data with which to construct your cross section. The next step will require adding the plugin qProf to QGIS.

  • Go to: Plugins>Manage and install plugins, find qProf in the huge list of available add-ons for QGIS and install it into your plugin directory
  • Open qProf which should now be located in your plugins menu. If you are successful a dialog box should open. This can be docked to your workspace.

This plugin is specifically designed for constructing geological cross sections and it covers more bases than most users will require. The creators have done a good job providing a help page directly in the plugin window so you don’t need to find that file on your system or even open your web browser!

Fig6_QProf Plugin
Figure 6. Installing the qProf plugin


Now the fun begins…

  • To create your profile click the first tab and define your input DEM’s and your input line (your cross section). You can add slope to your profile which will plot an additional line, useful in some engineering situations. There are also variables that can be modified, such as vertical exaggeration and profile direction.
  • Then just click the create profile button and hey-presto. The python script will create an additional window within QGIS that has additional functions for editing the plot position and other parameters such as line thickness, axes and labels.
  • You can the save your profile in a number of useful formats (.eps, .jpg, .pgf, .pdf, .png, .ps, .raw, .svg, .tif). With the ability to save as a scalable vector (SVG) the section can be easily imported into drafting software such as Inkscape so the cross section interpretation can be performed.

You can also create a profile from a list of GPX points. This is a great way to quickly build a section when you are in the field and it doesn’t require a DEM.

Fig7_QProf dialog box
Figure 7. The qProf plugin dialog window and controls for building the cross section
Fig8_Profile from DEM
Figure 8. The profile along XS1 calculated from the DEM represents the interface between the geological map and the subsurface interpretation. In the absence of drillholes it is also where all the geological constraints are.


With all that geological information on the map, we want to make sure that none is left behind so our interpretation has the most relevant constraints possible. Critical information is locked up in the structural data, which when visualized in profile with the mapped geology gives an excellent template for interpreting the subsurface geology. qProf is a great plugin because it can project points, lines and polygon data onto your profile.

To add Points (e.g. Bedding measurements) to the profile:

  • select the Projections tab in the widget and add the subset of your geological measurements (or all your traverse data)
  • make sure you direct qProf to predefined azimuth and dip fields (qProf uses dip and dip-direction here – you would have sorted out what your azimuths were when you first projected the data onto your geological map).
Fig9_Structural data projected on profile
Figure 9. Structural point data projected into the profile showing orientations derived from the dip and azimuth fields.

To add Lines (Geological traces and faults):

  • Geological traces (e.g. stratigraphic contacts) can be projected onto the section to guide the construction process. However this requires some knowledge of the plunge component where folding is concerned. This is something that is not always available and in complexly deformed areas has a variable orientation so would require very careful analysis to prevent meaningless lines in the section.
  • Fault positions can be added under the intersections tab, which projects labeled points onto the profile.

To add Polygons (your geology):

  • open the Intersect polygon layer tab that is within the Intersections tab.
  • In here it’s as simple as selecting the polygon layer containing the geology you are using in your cross section, and adding the classification field.
  • When you click the intersection button the classification field you defined will be listed in a pop-up window so you can attribute colours to your geology. Unfortunately qProf only supports 17 different colours (colour tables, modifiable colours and patterns would be good here).


At this point I should mention that there is a slight bug with the qProf plugin when you are dealing with complex geological shapes (e.g. folded stratigraphy). This is important because it took me the better part of a day to determine the cause of this and it could mean the difference between an efficiently produced cross section and giving up by uninstalling the plugin!

If you are intersecting polygons with your profile and QGIS returns the following (or similar) python error message:

C:/Users//.qgis2/python/plugins\qProf\”, line 3435, in do_polygon_intersections_start = sect_pt_1.distance( intersection_line3d._pts[0] )IndexError: list index out of range

you will need to return to your polygon’s shapefile and check for individual features that intersect your profile more than once (e.g. plunging folds, fault-offset stratigraphy where the shape has not been split along the fault trace). Unfortunately to get around this problem you will need to clip your shapes. In the example of multiple polygon intersections due to folding, you will need to split through the hinge so that each fold limb becomes its own feature.

Fig10_overcoming errors with multiple polygon intersections
Figure 10. Folded stratigraphic unit (selected: yellow) crosses the section line three times and forces Python to crash. To overcome the errors this polygon has been split into three individual shapes so that each may only cross the section once. Notice other split stratigraphic units to the right (purple, green and pink).
Fig11_intersected polygons
Figure 11. Intersecting polygons is successful when you get the polygon intersection colours pop-up window.

7. The populated profile

By now you should have a beautifully cluttered profile (if you have added too many data like me) and this will form the basis for constructing your interpretation outside QGIS. Unfortunately it is common for the geology labels to clutter up the display when you are at large scales or if you are constructing a section with many geological contacts. The symbology on the profile will stay at the same scale if you zoom in on the profile allowing segments to be viewed more clearly.

Fig12_Cluttered section
Figure 12. Geology labels cluttering up the cross section. qProf labels every polygon it intersects.
Fig13_blow up of section
Figure 13. Small segment of the section showing how the geology is displayed on the ground surface.


The next step is to export the profile as a figure. I prefer a scaleable vector graphic (.svg) because these are easily read by most graphical or drafting programs. A good open source program for modifying your profile and building your cross section is Inkscape. When you export the figure it is possible to change the figure’s width. One way to get around severely cluttered labels is to reduce the font size, increase the figure’s width, or a combination of the two.

Fig14_xsect open in Inkscape
Figure 14. Cross section .svg opened in Inkscape.


Finally, once all the previous steps are complete and you are satisfied with your output, open it up and you can start modifying, adding and interpreting the cross section geology.

Before you start it’s good practice to set up your work space by separating the various cross section elements (e.g. axes, labels, profile, structure, geology) into their own layers. This will avoid confusion once you have many elements on your interpretation and can allow for easier formatting of line style, weight, colour etc. It is also very useful to turn some layers on and off during the interpretation process and when producing figures (e.g. you may wish to show only one geological unit that is of particular interest).

Figure 15. Close-up of a segment of the profile showing relationship between geological unit, structural measurements and the interpretation. Note that bedding and cleavage have not been differentiated during the export. There is a clear contrast between the orientations of bedding measurements and axial planar cleavages.

As with any interpretation this stage takes practice and a good measure of brain power. There are many traditional methods that produce various section styles, each with applications relevant to certain types of geology or scale. Remember to honour the mapped constraints while keeping in mind structural style and potential geological variability. Make sure you know which areas are inherently ambiguous and which are close to truth!

Once you are satisfied with your interpretation of the cross section it can be saved in many formats or exported from Inkscape as a .png to return to 3D modelling software or for the production of figures.

Fig16_geological section interpretation
Figure 16. Completed geological cross section in Inkscape using the exported qProf colour palette.

Geological data courtesy of NSW Department of Industry Resources and Energy.

Download at:

Geological map originally published under:

Colquhoun, G.P., and Cameron, R.G., 2013. Yass Special 1:50 000 Geological Sheet (part 8628). Geological Survey of New South Wales, Maitland

One thought on “Construction of geological cross sections in QGIS

  1. When I project geological attitudes and select my points dip direction and dip, it says “check defined fields for possible errors”. I have no idea of what to do.

Leave a Reply

Your email address will not be published. Required fields are marked *