Page 2 of 75 (1497 posts)

  • talks about »


Last update:
Fri Apr 24 23:10:08 2015

A Django site.

QGIS Planet

The Coastal Vignette


Coastal Vignette seen on an old Irish ‘6-Inch map’

Occasionally on old maps you may see a pleasing decorative effect on bodies of water called a “Coastal Vignette”, these are fine lines that highlight coastlines and lake shores. The example seen above is from a ca. 100 year old “6-inch map” of Lough Nafooey in County Galway, Ireland. I presume the Coastal Vignette effect in this example was hand drawn, it required considerable skill and patience.

These is no plugin for creating Coastal Vignettes in QGIS just yet, so I developed a simple technique to recreate the effect using the raster Proximity (Raster Distance)’ algorithm accessible in the Processing Toolbox.

In order to use the Proximity Analysis tool I first converted a Shapefile polygon depicting the sea off Dublin into a 10 by 10 metre resolution Raster using the menu command ‘Raster – Conversion – Rasterize (Vector to raster)’.


This generated a Raster that coded the Sea as ‘1’ (white) and ‘0’ (black) for Land.

Next, I selected ‘Proximity (raster distance)’  from the Processing Toolbox – (GDAL/OGR) – [GDAL] Analysis – Proximity (raster distance). You can quickly find the command by typing the algorithm’s name in the box above the Processing Toolbox.


I entered 0 in the ‘Values’ box, this tells the Proximity algorithm to measure the distance away from land (a value of 0). The resulting Raster contains cell values that correspond to the distance away from the coast in metres, which I styled below.

The final step is to create Contours Lines from the Proximity analysis result using the menu item Raster – Contour. In my case I used an “interval between the contour lines” of 200 metres and I added an Attribute name called “DIST”.


The resulting contour lines have distance attributes attached to them can be used to create a Graduated colour style if needed, though in my cause I manually edited the attributes of 10 contour lines nearest the coast and I gradually increased the transparency of the mid-grey contour lines from opaque at the coast to fully transparent out at sea. I made the remaining contour lines transparent.

And here is the finished result, with the Sea and an OpenStreetMap base map styled to look just like Google Maps.

Finished Vignette 2

Adding ESRI’s Online World Imagery Dataset to QGIS

ESRI’s ArcGIS Online World Imagery is a high resolution satellite and aerial imagery base map for use in Google Earth, ArcMap and ArcGIS Explorer. The same excellent imagery is used by the Bing Maps Aerial layer. Somewhat surprisingly, World Imagery can also be accessed by QGIS, as it supports ESRI’s map servers that use Representational State Transfer (REST) and Simple Object Assess Protocol (SOAP) standards.

Simply copy and past the following code into the Python Console in QGIS and press return (Plugins – Console):


The code adds an ESRI Online World Imagery base map to QGIS. It has a number of advantages over the popular OpenLayers Plugin that adds various Google, Bing and OpenStreetMap image layers to QGIS. Unlike images downloaded by the OpenLayers plugin the ESRI World Imagery base map is a true Raster who’s attributes are fully editable e.g. brightness, blending mode and transparency can be adjusted. World Imagery can also be printed at a very high resolution with other QGIS layers on a map and without it shifting relative to other layers; a conspicuous problem with OpenLayers that does not use “On the Fly” re-projection and only prints Google, Bing layers at a low resolution. It is an ideal aerial base map.


QGIS: Adding An ArcServer Rest Service

Connecting to ArcGIS “mapserver” layers

Google Map Style with “Shape Burst” effect in QGIS 2.3

Here’s a nice looking map I created using QGIS 2.3, the testing version of QGIS. I downloaded free OpenStreetMap data and I styled it to look just like Google Maps, as per instructions published by Anita Graser. I also outlined county boundaries using the new “Shape Burst” effect, which creates a pleasing graduated colour pattern that faithfully follows polygon outlines (it’s also applied to the Sea, though it’s quite subtle). I used Data Defined Properties to restrict the effect to all counties except Dublin City, this also created a Mask.

Lastly, there’s also a subtle “Coastal Vignette” effect, these are fine lines that trace the coastline and were typical of old style hand drawn maps. Must have taken a tremendous amount of patience. I developed a simple method of reproducing the effect and I’ll let you know how I did it in my next blog post. Oh and by the way, the scale relates to a map printed at A3 size.


3rd Portugal QGIS user meeting (Covilhã) and QGIS‬ Conference 2015 (University of Copenhagen)

In the next weeks/months are due a couple of QGIS events where NaturalGIS will be present with presentations and workshops.

May 18th and 19th we will be at the QGIS Conference 2015 organized by the University of Copenhagen, Forestry College, that will take place in Nødebo, Denmark. This event is directly linked with the 13th QGIS Developer Meeting, that will take place from May 20 to 22 in the same location.

At the QGIS Conference we will make a presentation about how to get help/support for QGIS and a workshop about QGIS Server and how to publish OGC services (WMS/WFS/WCS) and webgis applications.

QGIS Conference 2015

June 5th we will be in Covilhã, Serra da Estrela, Portugal, to join the 3rd Portugal QGIS user meeting where we also will make a presentation (the same as in Nødebo) and a workshop about using the QGIS Processing toolbox.

3rd Portugal QGIS user meeting

Using Layer Visibility Presets in QGIS

One of the cool outcomes of our recent QGIS Legend Refactoring work was the ability to add "visibility presets". This feature allows users to save and load preset layer and group visibility settings.

Main canvas

First select the layers and groups, you’d like to manage visibility presets for. Now click at the top of the Layers panel and select Add preset … A new window will appear. Enter a name for the preset and click OK. Next time you click you should see the saved presets. The presets also save the visibility of categories in each layer.

In the video below, we create two presets. One for a specific site location and another zoomed to the outline of Great Britain which will be used as an overview in the print composer.

Print composer

The print composer now allows multiple map windows, each locked to a different layer visibility preset. This means a single map composer can show map windows with different layer arrangements.

In the video below, one preset is used for the main map and the other for an overview:

Crayfish 1.3: What's New!

Crayfish is becoming the must-have QGIS plugin for those working with the binary and ascii DAT/.2dm formats. Recently we had some requests from BASEMENT users to fully support the file format of their modelling package.

We have also been busy beta-testing our new illuvis flood risk communication service. Crayfish 1.3 integrates the illuvis client, allowing users to interact easily with this flood risk mapping service.

Read on for a look at some of the new features in more detail...

Advanced Styling

You can now turn off values below or above certain thresholds. This feature is very useful when you work with rainfall-runoff models and want to turn off values below e.g. 2 cm.

You can now set your colour ramps once, save them and apply them to other layers.

Export to Geo-TIFF

You can now easily export outputs from Crayfish to Geo-TIFF (.tif) files. Simply select the Quantity and Output time in the Crayfish viewer then right-click on the Crayfish layer in the QGIS Layers panel and select Export to grid…

Export to illuvis

For those users who have been using illuvis, you can now upload crayfish layers directly to the flood map publishing web service rather than first having to convert results to Geo-TIFF. If you would like to become an illuvis beta-tester, please contact us.

Support for BASEMENT

Users can now view outputs from the BASEMENT modelling package.

Binary package for Ubuntu

We love Linux and have finally managed to prepare crayfish binaries for Ubuntu 14.04. If you are using other distros, the compilation should be straight-forward using guide in the README file.


If you have some feedback or come across a bug, feel free to file a ticket on the issues page of the Crayfish github repository.


We’d like to thank The Laboratory of Hydraulics, Hydrology and Glaciology (VAW) of ETH Zurich for sponsoring some of the great features in this release.


Sourcepole war an der FOSSGIS 2015 in Münster unter anderem mit zwei Vorträgen zum präsent:

Datum transformations with NTv2 grids in QGIS: the easy way

NTv2 is a format/method to allow transform coordinates (and vector/raster layers) from one coordinate reference system to a different one (involving a change of datum) with a small error: the precision is usually around a few centimeters (or less) and is much better than the one that can be obtained by reprojecting layers using the standard coordinate reference systems definitions, as they are available in common GIS software/libraries/toolboxes.

Ntv2 Datum transformations precision
An example of the precision given by NTv2 tranformations
compared to the one obtained by reprojecting layers using standard CRS definitions.

Note: This is a rather complex matter so you may want to read some tutorial about it. One of the best we have ever read is this one [Portuguese or English].

The NTv2 method make use of binary files (.gsb) called ”grids” and is fully supported by libraries like Proj and software like GDAL/OGR. Until not long ago the availability of these grids was scarce but in recent times they have become quite easy to find and are freely available for many countries.

Unfortunately using this grid is not easy for the common GIS user: both command line utilities and Desktop GIS software need custom CRS definitions, downloading and copying files to specific locations and eventually do more configurations. See for example the following tutorials for QGIS or ArcGIS.

For the cases when grid files are freely available and redistributable we implemented an easier solution in the form of a QGIS plugin for its Processing toolbox. With this plugin the operation is as simple as just selecting the coordinate reference system of the input layer and the transformation (direct or inverse).

Ntv2 Datum transformations for the QGIS Processing toolbox
Ntv2 Datum transformations GUI

The plugin already comes with support for grids/transformations for a few countries and more will be added given that ntv2 grids are freely available and redistributable. If you want to have a certain grid/transformation/country added please open a request here

including all the necessary details.

Ntv2 Datum transformations for the QGIS Processing toolbox
Ntv2 Datum transformations for the QGIS Processing toolbox

Note2: The plugin was directly derived from a similar one that we helped develop for the Portuguese QGIS community/user group for the specific context of datum transformations for Portugal. At some point we felt that this plugin could have been useful also for users from other countries so we released an “international” version of it.

Game of Life – Raster edition

You probably remember my Game of Life posts from last year: Experiments with Conway’s Game of Life & More experiments with Game of Life where I developed a vector-based version of GoL.

Richard Wen and Claus Rinner at Ryerson University now published a raster-based version.

Here’s a screenshot of the script in action:

Screenshot 2015-03-08 20.04.07

The code is hosted on Github and I’m sure there will be many other ideas which can build on code snippets to read and write raster cell values.

For more info, please visit the GIS at Ryerson blog.

Generating an XYZ ASCII file from a QGIS raster

Someone wrote to me asking if it would be possible to generate an XYZ ASCII file from a single band raster layer in QGIS. No doubt there are more efficient ways (this approach is pretty slow but it works), but I thought it would be fun to show how you can iterate over a raster, writing out the value of each cell into a text file (along with the centroid coordinates for that cell).





To use the script, you should save it to your local machine, then open the python console and load the script in the python editor. Next select a single band raster and then run the script in the editor. If your raster is quite large, it will take some time to run. I have spent zero time trying to optimise the script – if someone has an idea for doing it faster, send me a patch and I will update the example above.

The generated output dataset will look something like this:



The resulting script can be used with programs like gdal_grid or loaded back into QGIS as a vector layer using the Delimited Text provider:


QGIS 74ac7f0 - raster_to_xyz_171

Computing network centers

How do you objectively define and compute which parts of a network are in the center? One approach is to use the concept of centrality.

Centrality refers to indicators which identify the most important vertices within a graph. Applications include identifying the most influential person(s) in a social network, key infrastructure nodes in the Internet or urban networks, and super spreaders of disease. (Source:

Researching this topic, it turns out that some centrality measures have already been implemented in GRASS GIS. thumbs up! computes degree, betweeness, closeness and eigenvector centrality.

As a test, I’ve loaded the OSM street network of Vienna and run -a input=streets@anita_000 output=centrality degree=degree closeness=closeness betweenness=betweenness eigenvector=eigenvector


The computations take a while.

In my opinion, the most interesting centrality measures for this street network are closeness and betweenness:

Closeness “measures to which extent a node i is near to all the other nodes along the shortest paths”. Closeness values are lowest in the center of the network and higher in the outskirts.

Betweenness “is based on the idea that a node is central if it lies between many other nodes, in the sense that it is traversed by many of the shortest paths connecting couples of nodes.” Betweenness values are highest on bridges and other important arterials while they are lowest for dead-end streets.

(Definitions as described in more detail in Crucitti, Paolo, Vito Latora, and Sergio Porta. “Centrality measures in spatial networks of urban streets.” Physical Review E 73.3 (2006): 036125.)

Centrality: low values in pink, high values in green

Centrality: low values in pink, high values in green

Works great! Unfortunately, is not yet part of the QGIS Processing GRASS toolbox. It would certainly be a great addition.

Get your QGIS merchandise while it’s hot!

Since the 2.8 release is done, the QGIS team has been busy with a small side project: setting up a series of shops for fans of QGIS. Right now, the following shops are available:

North America

There is a US and a Canadian shop. Additionally, there is also the possibility to design your own products (US, Canada).



There’s also a series of European shops, for example for the UK, Germany, and France. There are more, if Spreadshirt has a site for your country, there’s probably a QGIS shop too.


Thanks to Nathan for pointing out the Australian shop!

For each product sold, the QGIS project receives around $3 (minus applicable fees) which will go directly towards improving your favorite GIS.

Upcoming User Group Meetings

There are two upcoming user group meetings – one in Edinburgh and one in London. Tickets are available through Eventbrite. If you want to attend the Scottish event, click here, or if the South East is closer then click here.

As ever, we are always keen to hear from the users and if you have something you would like to share with the rest of the user group then please get in touch.  Lightning talks or longer 20 minute presentations welcomed.

Click here to get the draft agenda May 2015 v2.

Formação SIG: Produção cartográfica com QGIS

A NaturalGIS acrescentou à sua oferta de cursos QGIS uma formação de produção cartográfica, que permitirá aprender a produzir eficientemente mapas de elevada qualidade recorrendo às funcionalidades mais recentes de QGIS.

O curso cobrirá as opções avançadas de simbologia para camadas vectoriais e raster e etiquetas, o compositor de mapas e automatização de produção cartográfica, entre outros. Este curso é ideal para aprender tirar o maior partido do QGIS para criar mapas temáticos e cartografia para os instrumentos de gestão territorial, como por exemplo, PDM, PP, PU, etc.

A primeira edição terá lugar em Lisboa de 4 a 6 de Maio 2015.

Mais informações em:

Inscrições em:

Mapas espantosos com QGIS!
Aprenda a criar mapas tematicos com QGIS

Conteúdo Programático:

  1. Controlar ordem das camadas
  2. Simbologia vectores
  3. Simbologia rasters
  4. Simbologia por categorias
  5. Simbologia por quantidades
  6. Simbologia baseada em regras
  7. Simbologia avançada - níveis
  8. Modos de rendering e transparência
  9. Etiquetas
  10. Criação de símbolos compostos
  11. Gestor de símbolos
  12. Gravar, Importar e exportar símbolos
  13. Compositor de impressão
  14. Elementos do mapa (Escala gráfica, Norte, Legenda,…)
  15. Grelhas de coordenadas
  16. Mapas de enquadramento
  17. Optimização da produção de cartografia
  18. Filtrar legenda consoante visibilidade
  19. A ferramenta “atlas”
  20. Criar séries de mapas com a ferramenta “atlas”
  21. Presets e estilos múltiplos
  22. Controlo dos elementos e formato do mapa através dos atributos
  23. Criação de cartogramas
  24. Criação automática de mapas de ocorrência

QGIS 2.8 LTR has landed


It’s finally here! QGIS 2.8 LTR “Wien” is officially available for download now.

What’s an LTR

LTR stands for “Long Term Release”. This means that QGIS now has a system in place to provide a one-year stable release with backported bug fixes. The idea behind LTR is to have a stable platform for enterprises and organizations that don’t want to update their software and training materials more often than once a year. To make the LTR a success, users and developers alike should be aware that bug fixes should be applied to both the LTR branch as well as the normal development branch. If you are interested in the details, you can find more info in the corresponding QGIS Enhancement Proposal.

Users who enjoy working with the cutting-edge version will be able to follow the regular four-monthly release cycle like last year.

What’s new?

This new version comes with many great new features which you can explore in the official visual changelog. It’s really hard to pick but my personal favorites are:

On the layer styling front, there are two great additions: raster image fills and a live heatmap renderer which makes it possible to create dynamic heatmaps on the fly.

raster image fill

Raster image fill symbol layer type

Another feature I’m sure many of you will enjoy is the support for custom prefixes for joins.

Custom join prefixes

Custom join prefixes

Last but not least, I want to point your attention to the great improvements to the rule-based legend which is now structured in a nice tree.

Rule-based renderer legend tree

Rule-based renderer legend tree

Don’t forget to check out the other new features!


None of this would have been possible without the great QGIS community and all the many different people involved in running the project. Thanks a lot to all of you and a special shout out for the sponsors! *applause*


How to create a QGIS PDF report with a few lines of python

Sometimes you want to automatically generate a report to reflect the latest state of your data. For example you may be capturing spatial data into a PostGIS database and want a snapshot of that every few hours expressed as a pdf report. This example shows you how you can quickly generate a pdf based on a QGIS project (.qgs file) and a QGIS template (.qpt file).

Using this approach you can generate all kinds of useful outputs without ever needing to open QGIS each time you generate the report. Simply create the needed project and template files and then run it like this:


A QGIS plugin to run (common) spatial queries with PostGIS

QGIS Processing toolbox is extremely flexible and it allows easily to implement QGIS tools (with a GUI) that are based on command line utilities (see this and this).

When the underlying command line program is ogr2ogr (or any other GDAL/OGR utility) possibilities become endeless. For example ogr2ogr can be used to convert formats or run arbitrary (Spatial) SQL queries.

One possibility is to run Spatial SQL queries using input PostGIS layers and getting as output a PostGIS layer. The intersting bit is that the Spatial SQL query will be run by the server/machine (where the input layers are stored), so possibly not by the destkop machine where you are running ogr2ogr.

Usually to run a (Spatial) SQL query in PostGIS a user would open one of the many SQL shells available (PgAdmin, QGIS DB Manager, phppgadmin, psql, etc.) and run something like the following:

SELECT attribute1,(ST_Dump(ST_Union(a.geom))).geom::geometry(Polygon,4326) as geom
FROM input_table a
GROUP BY attribute1;

and that is ok for us geo-geeks, but what about average Jane/Joe?

Isn’t this much easier?

Dissolve PostGIS polygons
Dissolve PostGIS polygons

With this plugin for the QGIS Processing toolbox (available in the official QGIS plugin repository) we aim to bring into QGIS a set of tools to allow basic PostGIS users to run common queries (Dissolve, Clip, Difference, etc.), using as input PostGIS layer and getting as output PostGIS layer(s).

PostGIS QGIS Processing tools
PostGIS QGIS Processing tools

Please note that the plugin is still in the early stages of development and that it will be greatly improved once the Processing toolbox will support features like multi-attribute selection, adding to (QGIS) map output layers other than shapefiles, and others.

New geoprocessing tools in the QGIS Processing toolbox

QGIS 2.8 was not officially announced yet and, as always happens in the QGIS project, new features are already being added to QGIS master, aka next future release, in this case 2.10.

At NaturalGIS we do our share of effort, especially regarding improvements for the QGIS “Processing” toolbox, and recently started to add new geoprocessing tools for vectors. At the time we are writing the tools we added are:

  • Buffer
  • Single sided buffer (or offset lines)
  • Clip by extent
  • Clip by polygon
  • Create points along lines
  • Dissolve
ogr2ogr geoprocessing tools for QGIS Processing toolbox
New QGIS geoprocessing tools

Some are completely new, like the Single sided buffer (or offset lines), Clip (vector) by extent (a similar tool is already available in QGIS but only to clip rasters layers) and Create points along lines, others are not (Buffer, Clip by polygon and Dissolve) as there are already plenty of alternatives in QGIS. The point here is that this “new” tools are quite faster than the already existing QGIS counterparts, or they offer new options.

For example the “Dissolve” tool is on average several times faster (up to 7 times, in our simple tests) than the QGIS counterpart, moreover the tool has the ability to compute some statistics on numerical attributes. See the image below:

ogr2ogr geoprocessing Dissolve tool
Dissolve with stats

Under the hood the work is done by that great software that is ogr2ogr. In this case is used to run spatial SQL queries, using as engine SQLite/Spatialite

More of this ogr2ogr/sql based tools will be added in the next future, especially when a few missing features will be added to the QGIS Processing toolbox, meanwhile you can help us testing the above ones.

Under MS Windows you can install the development version of QGIS using the OSGeo4W installer. Under Ubuntu GNU/Linux you can use the nightly builds repository.

A new QGIS tool (based on ogr2ogr) to import vectors in PostGIS

In QGIS there are many tools that can be used to import vectors inside a PostGIS database, each one has pros and cons:

  • SPIT core plugin: available since early QGIS releases but now unmaintained tool and therefore candidate to be removed from future QGIS releases. It has the advantage to allow import several vectors in one run, but on the other hand it does not have an option to launder table/columns names and is overall quite slow especially for fair large vectors.
  • DB Manager: it has several pros, like supporting drag & drop import and a few important other options, but misses to allow import several vectors and is overall slow especially for fair large vectors.
  • QGIS browser: it allows import vectors using drag & drop but as the above tools missed to allow multiple vectors import. Overall slow especially for fair large vectors.
  • Processing toolbox ”Import into PostGIS”: it can import several vectors at once because, as any other tool in the QGIS Processing toolbox, it can run in batch mode. Overall slow especially for fair large vectors.

There are of course also command line alternatives, in particular shp2pgsql (together with psql) and ogr2ogr. Each one is rich of options/switches and they can be scripted to import several vectors in one go. While shp2pgsql is installed were PostGIS is installed, usually it is not on common users desktop machines. On the other hand ogr2ogr is installed and available on any machine where QGIS is installed because is part of the GDAL/OGR libary, that is basic dependency of any QGIS installation.

We compared how importing vectors in PostGIS performed using ogr2ogr compared to the tools available in QGIS, and then also compared to shp2pgsql. In short, the results are the following:

  • even without recurring to any particular switch/trick, ogr2ogr is on average much more faster than any available tools available in QGIS.
  • ogr2ogr and shp2pgsql performed in a similar way.

To compare ogr2ogr and shp2pgsql we used as input dataset a 4 million features (polygons) shapefile (1.3GB of space occupied) and also a small subset of it (4000 features, 10MB) using PostGIS installed on the local machine (Ubuntu GNU/Linux 14.04).

Without using any particular switch to make imports faster (like “-D” for shp2pgsql or “-config PG_USE_COPY YES” for ogr2ogr) ogr2ogr is much faster than shp2pgsql/psql with the small dataset (2.5 seconds against 35 seconds).

With the large dataset things gets the other way, with shp2pgsql/psql ending the task in 17 minutes against 19.5 minutes with ogr2ogr.

Adding the options “-D” to shp2pgsql and “-config PG_USE_COPY YES” to ogr2ogr is possible to get a dramatic improvement of the performace of both tools: ogr2ogr takes 0.8 seconds to process the small dataset and 2.21 minutes the process the big dataset, while shp2pgsql/psql takes respectively 24 seconds and 1.56 minutes.

ogr2ogr seemed a good choice to create a new tool for QGIS to allow import vectors in a fast way. We implemented such tool as part of the QGIS Processing toolbox and therefore is available the brand new QGIS 2.8 release.

QGIS Processing tools to import vector layers in PostGIS
The new tool(s) in the QGIS Processing toolbox

The tool also exposes options that are not usually available in any other QGIS tool. Aming the others: Vector dimensions, Append, Append and add new fields, Skip failures, Simplification, Densification, Import selected features by extent, Import clipped features by extent and a few others.

Tool GUI
Tool GUI

QGIS Instant Print Plugin

As a side product of a customer project, we’re publishing a QGIS plugin for printing maps to a file with just two mouse clicks.

To use the instant print tool, a composer needs to be created first. The only requirement is that it contains exactly one map item.

The instant print tool can then be activated from the plugin toolbar by clicking on the plugin icon icon.

In the dialog window which appears, one can pick the composer to use as page layout. A selection rectangle is displayed in the map canvas, sized according to the size of the map item in the composer and the scale chosen in the instant print dialog. The selection rectangle can be freely dragged around to choose the region one wishes to print. When dragging the selection rectangle, the previous rectangle is shown shaded and can be used as a snap reference when setting the new region. While the instant print tool is active, the canvas can be panned with the middle mouse button.


To instant print tool can be installed with the QGIS plugin manager and the sources are available on Github.

  • <<
  • Page 2 of 75 ( 1497 posts )
  • >>

Back to Top