Needful Things

Possibly I will gradually present or link to a few useful tools or methods that I have found or developed. But first of all, I have set up this page mainly to be able to publish my following molehill guide here, which was not welcome on gis.stackexchange.com.

Molehills in QGIS

Hill profiles or ‘molehills’ are an ancient type of relief representation that commonly appear in maps from the 16th to 18th centuries and, inspired by this, in maps of the fantasy genre. This guide explains how to automatically arrange hills, prepared as SVG graphics, with some additional work on your map in QGIS, based on downloaded elevation data.

Molehills in QGIS

Download Files

File Description
Maulwurfshügel in QGIS.pdf Guide in German
Molehills in QGIS.pdf Guide in English
Maulwurfshügel ∕ Molehills in QGIS.zip Complete package with guides, molehill SVGs and required Python scripts

Hachures in QGIS

After the molehill thing, I would have next wanted to find a method of creating hachures in QGIS based on elevation data. But probably I wouldn’t have succeeded as well as Daniel Huffman, who has just beaten me to it and developed a script he describes on his blog somethingaboutmaps.wordpress.com and offers for download on GitHub.

Maulwurfshügel in QGIS

Links

Description on Daniel Huffman’s blog
Download from GitHub repository

Connecting Network Fragments in QGIS to Straight Lines

For my work on a historical atlas, I downloaded the road network of the Roman Empire from various sources (e.g. from here, from here and from here). However, the line geometry was heavily fragmented — no road segment extended beyond the next junction, and there were many breaks even between intersections. For further processing, it seemed necessary to merge the geometry, and I considered it desirable to preferably connect those roads at junctions that meet from opposite directions, so as to obtain the straightest possible continuous lines. I also deemed it desirable not having to do this by hand, and thus I developed the following script together with ChatGPT.

Netzfragmente verknüpfen

before: many short fragments
Straßennetz vor der Bearbeitung
after: long, continuous lines, following the straightest possible course through junctions
Straßennetz nach der Bearbeitung

To use the script in QGIS, you can either save it as a new script within the Processing Toolbox or place it in the folder C:\Users\[username]\AppData\Roaming\QGIS\QGIS3\profiles\[profile name, e.g. default]\processing\scripts\ before starting QGIS.

The script is bilingual: it appears in German if QGIS is set to German, otherwise in English.

Download Script

Netzfragmente_verknuepfen.py

Line Displacement in QGIS

In the generalisation of a map, the need for line displacement often arises: whenever two lines — e. g. a road and a railway — come too close to each other at small scales, you face a dilemma. If both are shown in their exact position, they overlap unless you choose line widths so thin that they are hardly visible and no longer suitable for a map at this scale. The conflict is solved by displacement, i. e. by deciding which line is the more important, and then pushing the less important one away from it. Accuracy is sacrificed in favour of legibility.

As far as I can see, QGIS does not yet provide a simple way to achieve this; therefore, with the help of ChatGPT, I have written this plugin. It allows you to select one or more layers whose geometry shall stay fixed, and one or more layers whose geometry will be displaced from the former. Of course, the displacement distance can be set, along with various further options. Most importantly, the plugin offers the possibility to make itself dispensable: it can leave a symbol layer with a geometry generator in the displaced geometry, which can then control displacement in the future without plugin.

As a rule, the displaced geometry is written, either into a new temporary layer or into an existing one. Dynamic on-the-fly displacement is also possible (for this you have to select the debug level “pre_final”), but due to its computational intensity this will only be suitable for very simple geometries.

Plugin for line displacement

Here is an example from my current work: the dotted lines are the Roman roads from the dataset by Elijah Meeks, and as you can see, they do not really fit the coastline from the Natural Earth dataset — not only do they come very close to the coast, but they even slip out into the sea. The red line shows the displacement along the coast as produced with this plugin.

Plugin for line displacement

To install the plugin in QGIS, go to the menu “Plugins” → “Manage and Install Plugins …” → “Install from ZIP”.

The plugin is bilingual; it appears in German if QGIS is set to German, otherwise in English.

Download Plugin

LineDisplacement.zip