Visualizing 3D data with expressions

How to visualize point data with Z values? Let’s say: we have data about noise pollution in multi-storey buildings. The point data (apartments) looks like this:

selection_005The attribute table looks like this:

selection_004We see X and Y coordinates, and a Z (height) value. The DB column gives the actual noise data, which we want to visualize. How to do this?

One idea was to use diagrams. QGIS, however, gives only pie charts and histograms, which don’t satisfy in my case.

Another idea was the Point Displacement option in the styling of the layer. This didn’t work out well either, because I couldn’t arrange the points properly. I wanted to place them above each other, with the highest Z value on top.

The idea that did work out was to use Offset X,Y in the Symbol selector:

symbol-selector_007Using this, you can offset the marker symbols in horizontal (X) and vertical (Y) direction. Instead of just using X and Y values, you can also use an expression. Using an expression, you get the possibility to use values in the attribute table for changing the X and Y offset value for each point. That gave me the solution!

After a lot of trying I used this expression:

‘0, ‘|| to_string(-1 * “z”)

Let me explain. “z” is the height value I want to use. A positive Z value gives the marker a downward offset. I want it upward, so I took the negative of Z. Because the result of the expression has to be a string value, I used the to_string expression to do so. Because the expression changes both X and Y, and I didn’t want to change the X value, I used ‘0, ‘ in the beginning of the expression, and concatenated (||) the 2 expressions.
Here’s the result:

qgis-2-14-11-essen-verschovenpuntenmetexpressies_010Now you see all apartments in the different blocks: the markers at the bottom are the lowest in the block, at the top are the highest apartments. There are some gaps, because the data were incomplete. The small blue points indicate the original X and Y coordinates.

The possibilities of these expressions are myriad. And with adding text labels, you can use these expressions too, to place them exactly where you want (in the markers, beside the markers, whatever).

Good luck!

BGT import plugin

The Dutch Basisregistratie Grootschalige Topografie (BGT) is exchanged via gml.

Unfortunately the used gml application schema is quite involved and leads to incomplete imports in QGIS.

The BGT-import plugin is now available so that the gml files can be imported correctly.

To illustrate the point two screen shots (one wrong, and one right):

selection_276 selection_275

Gereference a medal

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.

medal-half-marathon-zwolle-on-map

The buildings are: Broerenkerk, Peperbus, Grote St. Michaelskerk, De Fundatie and Sassenpoort.

Regards,

Diethard Jansen

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).

polygonized

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:

https://www.pdok.nl/nl/producten/pdok-downloads/basis-registratie-kadaster/kadastrale-kaart

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
inlezen_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.
GDAL_convert

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”.
grens_naar_vlak

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

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

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 (http://plugins.qgis.org/plugins/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:

Removed:

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

New:

– AHN3 WMS, WFS en WCS
– 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.

2016_histrivieren