QGIS en het KLIC

Just released a new version of the KLIC viewer plugin for QGIS.
This was neccesary because the format of the information received has changed a lot! Before it only included the information on pipelines in raster format. Now the information on pipelines delivered in XML can include information in vector format .
The KLIC viewer plugin shows the result that you receive when you do a call before you dig request in the Netherlands at the National Land Registration and Mapping office named Kadaster.
klicbericht_in_vectorLoaded in QGIS the result look like this: A map with network information of different types of cables and pipes.
Before you plan to dig mechanically, you have to register online at the kadaster where you want to dig. Kadaster collects all information from all net owners that have pipes or cables in the digging area. Next you will receive an email with the result where you can download you Zip-file that contains information like shown above.
klicviewer_enThe plugin looks pretty simple, some buttons to load the Zip-file and a list that can be used to open included documents as wel.
klicviewer_themes_enThe plugin also has a tab with themes, you can use it to quickly turn on or of many layers with a particular theme.
All best wishes for 2019 and have lot of  fun with QGIS!
Regards, Diethard

Georefereren van een medaille

Yesterday I ran the half marathon of Zwolle wearing a hat with the previous QGIS logo. My time was not so special (2:08:47) but the medal I earned was. It shows a simple map of the city of Zwolle.

original medal of Zwolle half marathon 2017
De originele medaille van de halve marathon van Zwolle.

You can see some buildings but which ones?
I decided to georerence the medal and add a map using QGIS.

  1. First I scanned the medal to create a PNG image.
  2. Next I georefererence the image using Georeferencer GDAL plugin that is delivered with every QGIS installation but needs to be activated using the Plugin manager. In het menu Raster you can now start the georeferencer tool.
  3. Then I added the layer “lufolabels” using the PDOK plugin that you can easily install and download using the Plugin manager.

The result you see below.
The buildings are: Broerenkerk, Peperbus, Grote St. Michaelskerk, De Fundatie and Sassenpoort.
Diethard Jansen

Nieuwe release QGIS + boek!

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.

Kadastrale percelen genereren vanuit BRK

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)

Spatialite en verdwenen stijlen

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: http://qgis.nl/zwartsluis.zip
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)