Gray is the new Black

Sometimes I prefer to publish my map in gray instead of black. But all newly added QGIS composer items are set to black by default.

Turn Gray dialog
Turn Gray dialog

For changing the colors more easily and rapidly I created the “Turn Gray” plugin. By default it changes all foreground colors (labels and outlines) to gray. But you are free to choose more cheerful colors too. And for the background as well.

Right now not all composer items are supported, but the map, legend, labels and scale bar do. Tables, arrows and map grids will have to wait.

I hope others will be happy to use this tool as well, that’s the idea behind open source!

Here some examples:

original map composer
original map composer
turned to gray (default plugin values)
turned to gray (default plugin values)
turned to red foreground and lime green background
turned to red foreground and lime green background

New release of QGIS and book!

Last week not only QGIS 2.14.0 Essen was released but also a great book “QGIS Map Design” based on this new version of QGIS.

Voorpagina boek QGIS Map Design

A release of QGIS is special but this release concerns an announced LTR release.  QGIS 2.8.7 is the current LTR version in which al bugs found between 2.8 and 2.14.0 have been solved in 2.8 as well.

A (Long Term Release) LTR version has two major advantages. It is very stable and in time becomes even more stable and the functionality remains the same  over a longer period of time so instructions books and courses based on an LTR version can be used longer. When QGIS 2.16 appears, we will have a new LTR version of  QGIS 2.14.1! The name QGIS Essen refers to the city that hosted the hackfest twice. I was there and they were very inspiring and productive.

After QGIS 2.14 will be started with building QGIS 3 which will be a tremendous effort. QGIS 2 is now build on Qt 4 and Python 2.7. QGIS 3 will be build on Qt 5 and Python 3.5. Work has been started a long time ago with putting an excellent test framework in place with lots of unit tests.

Although currently QGIS 2.14 is not yet the QGIS LTR version, new manuals, books and instructions should be written on this new version of QGIS!

The first book that is based on QGIS 2.14 is already out! The book QGIS Map Design is written by Anita Graser & Gretchen N. Peterson and issued by Locate Press of Gary Sherman (The founder of QGIS). This is the first book focused on how to use the possibilities QGIS offers to create stunning maps.

The book presents many “recipes”, practical examples how to create a certain kind of map.

I could not wait an bought the book in PDF format counting 200 pages directly from Locate press. Remarkable, to buy the book you can use bitcoins as well besides using a creditcard!  You will receive an online personalized copy with a copyright statement underneath every page. Mine reads:

“Copyrighted material generated for Diethard Jansen on 2016-03-02 do not distribute”

I expect to have a lot of pleasure reading this book and using QGIS 2.14!

What has QGIS 2.14 to offer? Please have a look at the List of visual changes.

Generate parcels areas from parcel boundaries

Hi! In this blog I describe how you can create proper parcels with polygon geometry in from polylines (parcel boundaries) and points (Parcel point with parcel attributes placed inside parcel boundaries).


Since the 1st of januari 2016 a dataset named, BRK (Basis Registratie Kadaster) is available from PDOK. You can download these in GML format for each province and open directly in QGIS.

The BRK holds information on parcels, land areas. Every parcel is registrated with an unique ID at Kadaster, the Dutch Land Registration authority. They also register who owns the parcel of land and the historie of previous owners. De dataset BRK provides a momentary view of the parcels at a recent point in time.

I expected to receive polygons but the BRK included only lines and points. Fortunately, QGIS provides the tools to provide what I want.

The process of converting parcel boundaries with parcel points to parcel polygons includes globally following steps:

1) Read parcels provided in GML and save as Shape
2) Add spatial indexes to shape files
3) Convert parcel boundaries (lines) to areas (polygones)
4) Add attributes from parcel points to areas

1) First Download the dataset BRK of the Flevoland Province from the download webpage:

2) In this case, I unpack the downloaded zip-file in folder C:\data\brk\input\ and create the folder C:\data\brk\output for (intermediate) results.

3) Activate the Processing Toolbox from the menu Processing >> Toolbox. Turn rendering of in QGIS (right below in QGIS application window) and switch the interface of processing from Simplified interface to Advanced interface.
Render of and advanced interface

4) load both gml-files Kadastralegrens.gml and Perceel.gml

5) Save both GML files loaded to shape-format, in het layer panel you can select a layer and select in het menu Layers >> Save As…. Using the Processing Toolbox you can use Convert format (Translate format) [OGR] from the GDAL/OGR group of algorithms. When you double click on the algorithm the dialog opens that can be used to convert to many vector formats.

6) Make sure the created shapefiles are opened in QGIS first. To add a spatial index double click on a selected layer which opens the Layer Properties dialog. Use the button [Create spatial index] .
Create Spatial Index

7) To create parcel areas from boundaries, use the Processing Algorithm Polygonize. Search in the Processing Toolbox with “Polygonize”.

8) This algorithm takes a lot of time! At 40% it seems to stop, but please be patient. Let QGIS do its job.

9) Now add the attributes of the point layer Perceel.shp to created area layer KadastraalVlak.shp and I saved it to KadastralePercelen.shp.

When you select a parcel using the identify tool you should see following fields.
Eigenschappen Kadastraal Perceel

That’s it.

Regards, Diethard Jansen (GIS-hulp)

PDOK services plugin update

Mostly interesting for dutchies :-)

A short post that there is a new 0.10 version of the pdokservicesplugin (,

Some layers have been removed and some are new. The total number of layers is now 6723 (coming from 5298).

WMS layer windspeed at 100m height
WMS layer windspeed at 100m height

Most important changes:


– brtachtergrondtijdelijk
– brtachtergrondgrijstijdelijk
– top10nl (nu: top10nl2)
– Noordzee Kabels en Leidingen
– Noordzee Wingebieden


– Adressen (INSPIRE geharmoniseerd)
– CBS Wijken en Buurten 2014
– Historische Rivierkaarten
– Kadastrale Kaart
– NAPinfo
– Potentiekaart omgevingswarmte
– Potentiekaart reststromen
– Potentiekaart restwarmte
– Verspreidingsgebied habitattypen
– Windsnelheden 100m hoogte

Update your plugin via the plugin-manager in QGIS.


Spatialite and lost styles

In this blog I will explain how to recover styles that are included in a SpatiaLite database but are lost after renaming or moving the SpatiaLite database to another location.

It will show how to use the QGIS Field Calculator to change the contents of de field f_table_catalog in the table layer_styles so it directs to the proper full pathname of the SpatiaLite database. Afterwards the styles included in the SpatiaLite database are displayed correctly!

Save styles in SpatiaLite

Since QGIS version 2.4 it is possible to save the style given to a layer loaded from SpatiaLite inside the SpatiaLite database. When a new project is opened and you load that layer the saved style is applied. Wonderfull, but if you rename or move the file the saved style is not applied.

How to recover lost styles

For this example we will use an example SpatiaLite database zwartsluis.sqlite which can be downloaded using the following link:

This example database (filesize = 8 MB)  is actually made using de QGIS plugin Basis NL from which I removed all data outside the small beautiful municipality of Zwartsluis. It contains buildings, addresses and location for houseboats and mobile homes.

For this example I have placed the SpatiaLite database after download in a folder named C:\geodata\buildings.

  • Open the dialog to load the spatial tables from Spatialite into QGIS. Select from menu Layer >> Add Layer >> Add SpatiaLite Layer… .
  • In the dialog use the [New] button to create a new database connection to zwartsluis.sqlite. Now select in the list of connections the connection to zwartsluis.sqlite and press the [Connect] button.
  • Select the option Keep dialog open, select the 5 tables and load these using the [Add] button.
load all spatialite layers from zwartsluis.sqlite
load all spatialite layers from zwartsluis.sqlite

We see that arbitrary styles have been given to loaded layers.

Layers are loaded but saved styles are not used.

Layers are loaded but saved styles are not used.

  • Now select the option Also list tables with no geometry in the dialog Add SpatiaLite Table(s). More tables are available for selection including layer_styles, select this table and use the [Add] button to load it in QGIS.
Load the table layer_styles
Load the table layer_styles

When we open the table layer_styles in the Attribute table dialog, we can see that the field f_table_catalog refers to another file location. We will fix this using the Field Calculator that can be used to change the contents of existing fields!

  • Select the layer layer_styles and open the attribute table for this layer.
  • To make the layer editable select the yellow pencil ( Toggle Editing mode) in the toolbar of the Attribute Table dialog.
  • To start the Field calculator dialog select the abacus in the toolbar.
  • Now activate the option Update existing field and select the field f_table_catalog in the field selector underneath this option.
  • In the text entry area give the new full filepath for zwartsluis.sqlite. Surround the text with apostrophes. Use forward slash instead of the backslash that is used on windows OS as a separator. When below the text area Output preview shows the correct filepath, press [OK].
replace contents field f_table_catalog
replace contents field f_table_catalog

In the Attribute Table dialog the field of f_table_catalog now shows the right filepath.

  • Select again the yellow pencil and acknowledge you want to keep the changes.
  • Start a new project and reload the spatial tables from the SpatiaLite database, now the saved styles from the SpatiaLite database are used.

To load public web services provided by the Dutch government, we use the PDOK plugin, written by Richard Duivenvoorde. Here you can select the WMST service brtachtergrondkaart to load this as a background layer. When you go to the extent of the layer pand you will be zoomed in to Zwartsluis. If you zoom in further the objects from the SpatiaLite database become visible.

Now loaded with correct styles!
Now loaded with correct styles!

Diethard Jansen (GIS-hulp)

Change predefined scales plus new PDOK services

New PDOK services

This post is mostly interesting for dutch readers, as our national OWS service ‘PDOK’ added some new services. And we made them (5000 layers) available via the PDOK services plugin.

Change predefined scales

But I also want to show that you can change the predfined scales that you see in the Scale part of the statusbar in QGIS. By default these go from 1:500 till 1:1.000.000.


But if you are a user who almost always uses your national WMTS service layers als background layers, you will have more QGIS fun when you use your OWN scales there.
Because using the QGIS scales on a PDOK WMTS service, you will see this:


…unsharp tiles because the dutch WMTS tileschema is not in line with the ‘oldfashioned’ scales that QGIS shows you…

But as said: you can determine the scales that you see in the dropdown yourself by loading a simple XML file. For PDOK I created two example xml files which you can download here as a zip file. Unzip it and it will show you two xml files.
Via Settings/Options select the Map Tools tab and remove all excisting scales by using the red minus symbol button. You can now ‘load’ one of the scale xml configurations, and the dropdown will now look like this:


Using these scales, optimized for those WMTS service, you will have crisp tiles:


In this way you can (as a heavy WMTS user) make it easier to view your services on the optimal scales. You can even remove some scales which you never use!

Shot version: choose YOUR best scale, Happy QGIS-ing!

QGIS goodies

Just a short post in case you missed it.

Since some time QGIS is coorporating with, so we can open ‘virtual shops’ all over the world to sell QGIS t-shirst, caps and mugs.

So: check your size, and go via this page to the nearest QGIS-shop and make your friends jealous with our great QGIS shirts :-)


Oh, and the QGIS project receives a small percentage of this money to buy refreshments for during the hackfests…

Use of the Flemish geographical data portal Geopunt in QGIS

Geopunt website

Geopunt is the central portal for geographical data of the Flemish government. Beside an online viewer, a catalogue is available from where data can be downloaded. A lot of these data are free to download (e.g. orthophotos), other data is available depending on your user profile (e.g. soil map)

Download through the Geopunt4Qgis plugin

Geopunt recently developed a plugin for QGIS. After installation, you’ll find these icons added to your QGIS menu:


Whereas you can look up addresses, POI’s and road constructions, the possibility to search the Geopunt catalog from Qgis (last icon) is arguably the plugin’s best feature. From a pop-up window you can search all geopunt data. These data can be either added to your project directly as WMS of WFS, or can be downloaded. Whe you opt for download, you are redirected to the respective download page of geopunt or agiv. In the case of vector data, you should opt for shapefiles.

Legends for shapefiles

QGIS can manage shapefiles (.shp) very well, but not the ESRI legend files (.lyr of .avl) that usually come with them. The consequence is that the vector layer is loaded without the desired lay-out (all polygons have the same color and a black line border):

The soil map of Flanders opened in QGIS

You will have to make the legend yourself through the Style menu in the dialogue window vector properties. Choose ‘categorized’ in case of a discrete variable and refer to the corresponding column in the dataset. Now click ‘classify’. All column values will have a different color assigned to them. Now you can manually change these colors. In the last QGIS release (2.6), the handy ‘color picker’ can be used for this purpose.

The Color picker tool in the Style menu

Subsequently, open an example of the map (e.g. a pdf) in a separate window, and sample the correct color for each of the categories by clicking on the example map. The soil map layer in QGIS now just looks like the original:

The soil map of Flanders in QGIS with imitated legend

The legend can be saved through ‘save style’ in the layer properties window for all your future projects as well to share with other QGIS users. Choose QGIS Layer Style File (.qml). My .qml legends for the soil map and map of biological value (BWK2) of Flanders can be downloaded here. Hopefully Agiv will provide these legend files in the future through the Geopunt data portal!