QGIS Planet

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.

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:

You may also like...

Mergin Maps, a field data collection app based on QGIS. Mergin Maps makes field work easy with its simple interface and cloud-based sync. Available on Android, iOS and Windows. Screenshots of the Mergin Maps mobile app for Field Data Collection
Get it on Google Play Get it on Apple store
Learn More

Faking a Data Provider with Python

QGIS data providers are written in C++, however it is possible to simulate a data provider in Python using a memory layer and some code to interface with your data. Why would you want to do this? Typically you should use the QGIS data providers, but here are some reasons why you may want to give it a go: There is no QGIS data provider The generic access available through OGR doesn’t provide all the features you need You have no desire to write a provider in C++ No one will write a C++ provider for you, for any amount of money If you go this route you are essentially creating a bridge that connects QGIS and your data store, be it flat file, database, or some other binary format.
Learn More

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.

Problems -------- 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. Sponsors -------- 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.

You may also like...

Mergin Maps, a field data collection app based on QGIS. Mergin Maps makes field work easy with its simple interface and cloud-based sync. Available on Android, iOS and Windows. Screenshots of the Mergin Maps mobile app for Field Data Collection
Get it on Google Play Get it on Apple store
Learn More

FOSSGIS 2015

Sourcepole war an der FOSSGIS 2015 in Münster unter anderem mit zwei QGIS-Vorträgen präsent: Neues von QGIS QGIS Plugins - Must-Haves, Fachlösungen und Geheimtipps
Learn More

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.

Learn More

Hack to adjust map symbols location in QGIS

EN | PT

Now and then I get too many map symbols (points) in the same place, and I thought how nice it would be if we could drag n’ drop them around without messing with their geometries position, just like we do with labels. That thought gave me an idea for a cool hack.

Choose your point layer and start by creating two new fields called symbX and symbY (Type: Decimal number; Size: 20; Precision: 5). Now go the layer properties and in the Style tab edit your symbol. For each level of your symbol select “map units” as the offset units, and set the following expression in the offset data define properties option:


CASE WHEN symbX IS NOT NULL AND symbY IS NOT NULL THEN
    tostring($x - symbX) + ',' + tostring($y - symbY)
ELSE
    '0,0'
END

Screenshot from 2015-02-22 18:18:43

Be aware that, if your coordinates have negative values, you need to adapt the code. E.g., If you have negative values in X you should use “tostring(symbX -$x)” instead.

Now, temporarly  label your layer with a small convenient text (I used a centered ‘+’ (plus sign) with a white buffer) and set its coordinates to data defined using the symbX and symbY Fields.

Screenshot from 2015-02-22 22:42:07

From this point on, when you use the move label tool, not only the label position change but also the actual symbol! Pretty cool, isn’t it?

anim

Notice that the features geometries are not changed during the process. Also, remember that in this case you can also add leading lines to connect the symbols to the original position of the points.

Learn More

Loading MasterMap: Free, Easy and Fast

We've developed a new graphical loading tool for OS MasterMap data focussing on usability and performance to make it easy to load national Ordnance Survey MasterMap datasets in a matter of hours.

OS Translator II - Load OS MasterMap into PostGIS quickly, easily and for free

The tool is OS Translator II - it makes use of the excellent GDAL library and is available now in the official QGIS Plugins repository.

This blog post talks about some simple benchmarks we've carried out.

If you are interested in using this tool and not familiar with Postgresql/PostGIS, you can sign up to one of our support packages and we will be able to set you up and running within a couple of hours!

Results

National load times were as follows:

  • MasterMap Topography (National) 20 hrs 21 mins 1
  • MasterMap ITN (National) < 6 mins

Installing PostgreSQL, PostGIS and QGIS took less than 10 minutes.

1 This is the most time-consuming test which filled the SSD on the first attempt. Importing to a tablespace on the main HDD completed after 20.3 hours but showed the import of tile 1592959-TR0585-5c3268.gz to have failed with this error. Until this issue is resolved the tile would need to be loaded and de-duplicated manually (e.g. using ogr2ogr to import and a SQL query to de-duplicate) to complete the dataset. De-duplication removes duplicate features caused by the chunking / supply process.

Comparison With Other Open Source Tools

We were curious as to how OS Translator II load times compared with other open loading methods so we did some basic tests using the "SU" tile of MasterMap Topography and ITN datasets and compared it with the popular Loader scripts. The results looked like this:

OS Translator II Benchmarks

Please note that OS Translator II had an unfair advantage in these tests as it automatically takes advantage of multiple-CPU cores whereas Loader presently does not.

Hardware and Software

We used the following hardware and software configuration:

  • CPU Intel Core i7 4790K (Haswell) @ 4GHz
  • Memory 32GB PC3-12800
  • Disk(s) Samsung 840 EVO 250GB SSD and Seagate Barracuda ST2000DM001 2TB HDD2
  • OS Microsoft Windows 7 Professional (64-bit)
  • PostgreSQL 9.4.1 (x64)
  • PostGIS 2.1.5 (x64)
  • QGIS 2.6.1 (Brighton)
  • OS Translator II 1.0
  • Python 2.7.9 (win32)
  • lxml 3.2.3 (win32)
  • Loader Master (067a511313, 20th February 2014)

2 Operating system and source gml.gz files located on the SSD and default PostgreSQL tablespace stored on secondary 2TB HDD.

PostgreSQL Configuration

The following changes were made to the default PostgreSQL configuration:

  • shared_buffers 512MB
  • work_mem 16MB
  • maintenance_work_mem 128MB / 1024MB3
  • checkpoint_segments 6
  • random_page_cost 2.0
  • fsync off

3 maintenance_work_mem was set to 1024MB for the national load of MasterMap Topography layer only.

Turning fsync off is dangerous and can lead to data loss in the event of an unexpected power outage. Always switch fsync back on after loading and never use this option on a database containing critical data.

You may also like...

Mergin Maps, a field data collection app based on QGIS. Mergin Maps makes field work easy with its simple interface and cloud-based sync. Available on Android, iOS and Windows. Screenshots of the Mergin Maps mobile app for Field Data Collection
Get it on Google Play Get it on Apple store
Learn More

Plugin Builder 2.8.1

This minor update to the Plugin Builder allows you to choose where your plugin menu will be located. Previously your menu was placed under the Plugins menu. At version 2.8.1 you can choose from the following main menu locations: Plugins Database Raster Vector Web Plugins is the default choice when you open Plugin Builder. The value you choose is also written to the category field in your metadata.txt file.
Learn More

Plugin Builder 2.8

Plugin Builder 2.8 is now available. This is a minor update that adds: Suggestion for setting up an issue tracker and creating a code repository Suggestion for a home page Tag selection from a list of current tags Documentation update, including information about using pb_tool to compile, deploy, and package your plugin New URLs for Plugin Builder’s home page and bug tracking Optional is now Recommended In previous versions the following items were “Optional” when creating a new plugin:
Learn More

Towering QGIS 2.8 Release

The new QGIS 2.8 release (codename: Wien) is out tomorrow!

Lutra’s very own QGIS core developer Martin Dobiaš has been working hard with others on bringing you new stuff. So, what exciting new features are provided by this jauntily-angled new release? There are plenty of eagerly-anticipated additions - both big new features, and under-the-hood improvements - as well as bugfixes.

Multiple Stylings

Have you ever found yourself duplicating layers just so you could display the same data but with additional styles? Those days are now over.

You can now define multiple styles for a single layer, and easily switch between them in the layer view or layer properties dialog.

Multiple styles in the legend

Multiple styles in the layer dialog

Just so our webmapping colleagues don’t feel left out this new behaviour is extended to the WMS server too. The available multiple styles are advertised in GetCapabilities and can be used in other requests, such as GetMap.

And of course it all works in the map composer too - which means more maps with the same layers displayed in different styles.

Multiple styles in the map composer

Work carried out in cooperation with Gis3W for Regione Toscana.

Making It Snappy

Snapping is made simpler with the addition of new modes for snapping, so you can now:

  • Snap to current layer
  • Snap to all layers
  • Perform advanced per-layer snapping (previously the only mode)

New snapping modes

There’s also less confusion with snapping tolerances being to map units or layer units, so those anticipated 1 metre tolerances don’t become 1 degree tolerances without you knowing.

Snapping is not only more straightforward - it’s now much faster too thanks to using an index of geometries built when first needed. Because everybody loves faster, right?

For our developer colleagues there is an easy to use API which - amongst other things - adds fast point in polygon queries.

Funded by Ville de Vevey, SITNyon and QGIS Usergroup Switzerland.

More info here.

Simplify Simplified

QGIS has had a simplify tool for a while, but now it’s been significantly improved with lots of tasty new ingredients.

Improved simplify tool

Simplify tool tolerances used to be different for every feature - but not any more, and users can specify exact tolerances - which can be in map units or layer units.

Also new is on-the-fly reprojection support, tolerance settings are now persistent between sessions, dragging a rectangle instead of just clicking to simplify multiple features, support for multi-part features, and statistics about reduction of the number of vertices - because if you’re simplifying, it’s nice to know by how much! Oh yes, and faster too!

Work carried out in cooperation with Kartoza.

One Legend To Rule Them All

The display of rules in the legend for rule-based rendering has continued its evolution in features from QGIS 2.4:

QGIS 2.4: Good - a flat list of rules, but you can’t see the nesting.

Rules in 2.4

QGIS 2.6: Better - shown as a pseudo-tree with checkboxes.

Rules in 2.6

QGIS 2.8: Best - great for power-users who use complex styling rules to give their maps that extra zing.

Rules in 2.8

Funded by SIGE.

Long-Term Love

QGIS is also the first Long-Term Release (LTR) version - starting with 2.8 every third release is a long-term-release - maintained until the next long-term-release occurs.

Even if you’re a new-feature-junkie, you’ll appreciate the commitment by the project to both innovation and stability, and this of course underlines the burgeoning success of QGIS in enterprise environments.

So, start your engines, and get ready to download!

Making It Happen

While you’re still reeling from finding out about some of the new goodies that QGIS 2.8 brings (and check the official QGIS changelog for more!), I’ll remind you that all this cool stuff somehow needed to be paid for.

Thanks go to the organisations and individuals that sponsor or contribute to the QGIS project, and those that fund development of specific features. They make the software better for everyone, and you or your organisation could become one of them!

We at Lutra Consulting are Bronze level sponsors of the QGIS project, and use our development experience to contribute code and develop plugins for QGIS.

We tackle this in several ways, including direct approaches from clients to fund custom development, and crowdfunding campaigns. So, if you’re interested in some functionality that isn’t yet there - get in touch!

You may also like...

Mergin Maps, a field data collection app based on QGIS. Mergin Maps makes field work easy with its simple interface and cloud-based sync. Available on Android, iOS and Windows. Screenshots of the Mergin Maps mobile app for Field Data Collection
Get it on Google Play Get it on Apple store
Learn More