QGIS Planet

QGIS UK Edinburgh: an overview

6th Scottish QGIS UK user group meeting
Informatics Forum, University of Edinburgh, Edinburgh
3rd November 2016

A full house with all tickets sold. Our biggest event yet. A last minute decision to video the talks. A first ever raffle to raise funds for the QGIS project. More than half the attendees were at a QGIS user group for the first time. All sectors represented and a range of talks from accessible introductions to QGIS functionality to wonderful technical geekery to varied FOSS4G use cases.

Slides

Video: https://youtu.be/kHDZmmzKU4U

How deep is your loch?
Phil Taylor (@scienceandmaps) from CEH opened up the day with a detailed explanation of how he lovingly captured the plumbed depths of four Scottish lochs and turned them into interactive 3D visualisations. You can see his results at http://contours.org.uk/bathymetry

Slides

Video: https://youtu.be/-q021mocJdI

QGIS Server: the good, not-so-good and the ugly
Fiona Hemsley-Flint showed us the exploratory work she and her team have done with QGIS Server as a possible replacement for MapServer and Cadcorp GeognoSIS. QGIS server is capable and can render complex styles and labels well but was generally 5 to 10 times slower than GeognoSIS in rendering the maps.

Slides

Video: https://youtu.be/TPoOOkurtlA

Installing QGIS on a Network
Tom Armitage (@MapNav_Tom) from the University of Edinburgh gave a quick run through of the requirements for installing QGIS 2.14.3 across 3000 computers.

Slides

Video: https://youtu.be/fv3fgI-u084

Mapping narrative: QGIS in the Digital Humanities 
Anouk Lang (@e_a_lang) from the University of Edinburgh explained how mapping and visualisation were used to engage students and explore literature in a different way.

Slides

Video: https://youtu.be/XlADXIrC9PE

QGIS Plug-in for Parallel Processing in Terrain Analysis
Art Lembo (@artlembo) from Salisbury University, Maryland, USA got everyone excited about advances in personal computing power and how graphics cards can be harnessed to speed up spatial processing. The trouble with geographic data is that it is usually a large chunk of data with relatively little processing required. Parallel processing likes small chunks of data that need huge amounts of processing. The plugin hits the limit of the ability of Python to pass through more data. That’s how fast the graphics cards are.

Slides

Video: https://youtu.be/mkDMFiVLdkg

Viewshed analysis and how to find the heart of Scotland
Neil Benny (@bennymapper) from thinkWhere gave a very useful overview of how to use the different tools in QGIS to generate viewsheds which a lot people at the event could see a use for in their workflows. See https://blog.thinkwhere.com/2016/08/25/viewsheds-and-visibility-analysis-in-qgis/ for more information.

Slides

Video: https://youtu.be/LOPuw2-oaPA

qgis2web: geocrustin’
Tom Chadwin (@tomchadwin) from NNPA gave an entertaining talk on how and why he developed the qgis2web plugin. He showed us how to use it and you can see why it is such a popular extension to QGIS.

Video: https://youtu.be/4gyW1aeoTvU

QGIS 3.0, WMTS previews and XYZ support in QGIS 2.18
Pete Wells (@lutraconsulting) from Lutra Consulting gave a more technical talk on some behind the scenes work that they have been doing to make using QGIS 3.0 even better for the user. No more waiting for the base map to load as the WMS server thinks about the request – tiled services quickly and seamlessly fill the screen. For more information see http://www.lutraconsulting.co.uk/blog/2016/10/26/qgis-xyz-tile-wmts-preview/

Video: https://youtu.be/Q83W0XJ2Y3g

Decision Support Systems in Forestry
Stephen Bathgate (@Forestry_Research) from the Forestry Commission gave a real world example of how a GIS, and then an open source GIS infrastructure, delivered improved workflows, better efficiencies and made a smaller workforce more effective.

Slides

Video: https://youtu.be/94_y1qbqk-w

Collecting spatial survey data with Leaflet and OpenStreetMap
Louise Sing (@sing_louise) from Forestry Commission gave a lightning talk on how she used tips learned at previous QGIS user group meetings to put together a simple Leaflet map to collection information about how people use different areas of forest.
Slides

Video: https://youtu.be/-SCvsqy6txU

Indoor 3D routing with QGIS and pgRouting
Tim Manners (@tmnnrs) from Ordnance Survey demonstrated the interactive 3D route solving application created using QGIS and the QGIS2threeJS plugin. It can be used to route between locations spread across multiple floors in a building. It can take into account width and height restrictions such as doorways and lifts and can be used to model mass evacuations of a workforce.

Slides

Video: https://youtu.be/H-v9SXwc3BQ

Using QGIS for wildlife surveys and reporting
Andrew Whitelee (@VerdantWildlife) from Taylor Wildlife lead an interactive talk highlighting the difficulty of undertaking robust repeatable wildlife surveys in the great outdoors. He showed how the use of high quality mapping and GPS tracking improved the quality of the surveys and how much sense the use of open source software made for small enterprises.

Slides

Video: https://www.youtube.com/watch?v=pJhXdYqEmuQ

Them Thar Hills: shadin’, texturin’, blendin’
Ross McDonald (@mixedbredie) from Angus Council gave a lightning talk on different ways to generate hillshaded images from elevation models. Regular hillshaded images can be enhanced by generating texture shaded images. Texture shading enhances the drainage network and the visual hierarchy of the landscape. Blender can be used to create rich shaded relief by modelling real sunlight and reflection across the landscape. See textureshading.com for more information or press F7 in a recent version of QGIS to open the live style dock.

Slides

Video: https://www.youtube.com/watch?v=0nkNgtKGbw4

DOHA: Doha Online Historical Atlas
Michal Michalski from Scottish Government and the DOHA project showcased the mapping work he has been helping with in Doha and the archaeological investigation into the origins of the city. The website is a fantastic example of the integration of different resources including historic maps, photographs, videos and historic records. See http://originsofdoha.org/doha/index.html for more information.

Video: https://www.youtube.com/watch?v=xYegqHRoAic

3D indoor maps with QGIS
Tim Jenks (@eeGeo) from eeGeo gave a short talk on how QGIS and other tools were used to build navigable 3D maps of cities and buildings. See https://www.youtube.com/watch?v=c6T_v_e5Re8 for a demo.

Slides

Tom Armitage closed with some remarks on how open source software works and how the QGIS community supports the QGIS project. Roger Garbett managed the raffle (all 500 tickets sold!) with some great prizes (Splash-Maps voucher, QGIS t-shirt voucher, OS colouring map book, Art Lembo’s text book on geospatial processing, stickers and others) the proceeds of which will go to the QGIS project. There is, after all, no such thing as a free lunch. Even if fantastic and generous sponsors – Ordnance Survey, thinkWhere, Angus Council, Cawdor Forestry, eeGeo and EDINA – give us a lovely selection of food and drink (thanks BlueSkyCatering) and a top-class venue for a brilliant day out.

Slides

Video: https://youtu.be/cVEPbogf0To

The day ended in the Potting Shed with (strong) cask ales and ciders refreshing parched throats. Always a great way to wrap things up.

qgisug_sponsors_white

Learn More

WMTS enhancement and XYZ tile native support in QGIS 2.18

In this post, we will highlight the new features we have added to QGIS 2.18 …

WMTS enhancement

The WMTS provider had not been benefiting from the the QGIS multi-threaded rendering we did earlier in QGIS 2.4.

In previous versions of QGIS, users had to wait until download of all tiles of a layer has finished in order to view the resulting map. This has now been fixed and the tiles show up in map canvas immediately as they get downloaded, improving the user experience by greatly lowering the time until something is shown.

Moreover, previously downloaded tiles from lower or higher resolutions may be used for the preview functionality in the areas where the tiles with correct resolution have not been downloaded yet.

The screencast here shows fetching and rendering a WMTS layer in QGIS 2.14 (left) and the same layer in QGIS 2.18 (right):

Support for XYZ raster tiles

There are a couple of python plugins allowing users to add XYZ tiles (e.g. Bing maps) to QGIS. The plugins only allow certain web services and it is often tricky for supporting the private ones with API keys.

In addition, there are other QGIS applications without python support (e.g. QGIS for Android devices) where they can leverage from having a native support.

Currently, you can only add XYZ tile services from the Browser panel. The video below demonstrates how to add the current precipitation and OpenStreetMap xyz tiles to your QGIS:

Sponsors

WMTS enhancements was sponsored by Land Information New Zealand. Support for XYZ tiles was funded internally.

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

Speeding up your PyQGIS scripts

I’ve recently spent some time optimising the performance of various QGIS plugins and algorithms, and I’ve noticed that there’s a few common performance traps which developers fall into when fetching features from a vector layer. In this post I’m going to explore these traps, what makes them slow, and how to avoid them.

As a bit of background, features are fetched from a vector layer in QGIS using a QgsFeatureRequest object. Common use is something like this:

request = QgsFeatureRequest()
for feature in vector_layer.getFeatures(request):
    # do something

This code would iterate over all the features in layer. Filtering the features is done by tweaking the QgsFeatureRequest, such as:

request = QgsFeatureRequest().setFilterFid(1001)
feature_1001 = next(vector_layer.getFeatures(request))

In this case calling getFeatures(request) just returns the single feature with an ID of 1001 (which is why we shortcut and use next(…) here instead of iterating over the results).

Now, here’s the trap: calling getFeatures is expensive. If you call it on a vector layer, QGIS will be required to setup an new connection to the data store (the layer provider), create some query to return data, and parse each result as it is returned from the provider. This can be slow, especially if you’re working with some type of remote layer, such as a PostGIS table over a VPN connection. This brings us to our first trap:

Trap #1: Minimise the calls to getFeatures()

A common task in PyQGIS code is to take a list of feature IDs and then request those features from the layer. A see a lot of older code which does this using something like:

for id in some_list_of_feature_ids:
    request = QgsFeatureRequest().setFilterFid(id)
    feature = next(vector_layer.getFeatures(request))
    # do something with the feature

Why is this a bad idea? Well, remember that every time you call getFeatures() QGIS needs to do a whole bunch of things before it can start giving you the matching features. In this case, the code is calling getFeatures() once for every feature ID in the list. So if the list had 100 features, that means QGIS is having to create a connection to the data source, set up and prepare a query to match a single feature, wait for the provider to process that, and then finally parse the single feature result. That’s a lot of wasted processing!

If the code is rewritten to take the call to getFeatures() outside of the loop, then the result is:

request = QgsFeatureRequest().setFilterFids(some_list_of_feature_ids)
for feature in vector_layer.getFeatures(request):
    # do something with the feature

Now there’s just a single call to getFeatures() here. QGIS optimises this request by using a single connection to the data source, preparing the query just once, and fetching the results in appropriately sized batches. The difference is huge, especially if you’re dealing with a large number of features.

Trap #2: Use QgsFeatureRequest filters appropriately

Here’s another common mistake I see in PyQGIS code. I often see this one when an author is trying to do something with all the selected features in a layer:

for feature in vector_layer.getFeatures():
    if not feature.id() in vector_layer.selectedFeaturesIds():
        continue

    # do something with the feature

What’s happening here is that the code is iterating over all the features in the layer, and then skipping over any which aren’t in the list of selected features. See the problem here? This code iterates over EVERY feature in the layer. If you’re layer has 10 million features, we are fetching every one of these from the data source, going through all the work of parsing it into a QGIS feature, and then promptly discarding it if it’s not in our list of selected features. It’s very inefficient, especially if fetching features is slow (such as when connecting to a remote database source).

Instead, this code should use the setFilterFids() method for QgsFeatureRequest:

request = QgsFeatureRequest().setFilterFids(vector_layer.selectedFeaturesIds())
for feature in vector_layer.getFeatures(request):
    # do something with the feature

Now, QGIS will only fetch features from the provider with matching feature IDs from the list. Instead of fetching and processing every feature in the layer, only the actual selected features will be fetched. It’s not uncommon to see operations which previously took many minutes (or hours!) drop down to a few seconds after applying this fix.

Another variant of this trap uses expressions to test the returned features:

filter_expression = QgsExpression('my_field > 20')
for feature in vector_layer.getFeatures():
    if not filter_expression.evaluate(feature):
        continue

    # do something with the feature

Again, this code is fetching every single feature from the layer and then discarding it if it doesn’t match the “my_field > 20” filter expression. By rewriting this to:

request = QgsFeatureRequest().setFilterExpression('my_field > 20')
for feature in vector_layer.getFeatures(request):
    # do something with the feature

we hand over the bulk of the filtering to the data source itself. Recent QGIS versions intelligently translate the filter into a format which can be applied directly at the provider, meaning that any relevant indexes and other optimisations can be applied by the provider itself. In this case the rewritten code means that ONLY the features matching the ‘my_field > 20’ criteria are fetched from the provider – there’s no time wasted messing around with features we don’t need.

 

Trap #3: Only request values you need

The last trap I often see is that more values are requested from the layer then are actually required. Let’s take the code:

my_sum = 0
for feature in vector_layer.getFeatures(request):
    my_sum += feature['value']

In this case there’s no way we can optimise the filters applied, since we need to process every feature in the layer. But – this code is still inefficient. By default QGIS will fetch all the details for a feature from the provider. This includes all attribute values and the feature’s geometry. That’s a lot of processing – QGIS needs to transform the values from their original format into a format usable by QGIS, and the feature’s geometry needs to be parsed from it’s original type and rebuilt as a QgsGeometry object. In our sample code above we aren’t doing anything with the geometry, and we are only using a single attribute from the layer. By calling setFlags( QgsFeatureRequest.NoGeometry ) and setSubsetOfAttributes() we can tell QGIS that we don’t need the geometry, and we only require a single attribute’s value:

my_sum = 0
request = QgsFeatureRequest().setFlags(QgsFeatureRequest.NoGeometry).setSubsetOfAttributes(['value'], vector_layer.fields() )
for feature in vector_layer.getFeatures(request):
    my_sum += feature['value']

None of the unnecessary geometry parsing will occur, and only the ‘value’ attribute will be fetched and populated in the features. This cuts down both on the processing required AND the amount of data transfer between the layer’s provider and QGIS. It’s a significant improvement if you’re dealing with larger layers.

Conclusion

Optimising your feature requests is one of the easiest ways to speed up your PyQGIS script! It’s worth spending some time looking over all your uses of getFeatures() to see whether you can cut down on what you’re requesting – the results can often be mind blowing!

Learn More

Notes from the QGIS-UK South West user group

Yesterday Dartmoor National Park was host to the third QGIS user group for the South West region. We a great range of talks from the worlds of academia, offshore exploration and local government to name but a few. The slides from these are below.

Teaching in QGIS

Using PostGIS within our Geospatial Workflows at Lloyd’s Register

The Adoption of QGIS at Plymouth Community Homes

Integrating QGIS functionality into a data workflow through both automated processing and a plugin

PopChange: An Academic Open Source Project

Building a Mixed GIS Environment at the Met Office

We are looking at having another meet up in the spring and are thinking of running some workshops on form designing and plugin building. Keep an eye on the main QGIS user group page on Google+ for any news.

Thanks again to everyone who attending and presented.  We also need to give a special thanks to Clear Mapping Company for sponsoring the event.

Cheers

Matt

Learn More

6th QGIS UK user group meeting in Edinburgh

The 6th QGIS UK user group meeting in Scotland is happening on the 3rd November 2016.  It is being hosted by the EDINA University of Edinburgh at the Informatics Forum and is sponsored by thinkWhere, Ordnance Survey, Angus Council and Cawdor Forestry.  Tickets are available through Eventbrite.

The almost final programme of presentations and lightning talks is as follows:

  • Phil Taylor (CEH) – How deep is your loch?
  • Fiona Hemsley-Flint – QGIS server
  • University of Edinburgh – packaging and deploying QGIS
  • Anouk Lang – Mapping narrative: QGIS in the humanities classroom
  • Art Lembo (Salisbury University, MD) – terrain analysis with massively parallel processing techniques (embarrasingly so)
  • Neil Benny (thinkWhere) – finding the heart of Scotland / viewshed analysis
  • Tom Chadwin – qgis2web and coding a QGIS plugin
  • Pete Wells (Lutra) – WMTS previews and XYZ support
  • Stephen Bathgate – decision support system in Forestry
  • Tim Manners (Ordnance Survey) – Creating an indoor routable network with QGIS and pgRouting
  • Andrew Whitelee – QGIS in forestry/ecology
  • Ross McDonald (Angus Council) – Them thar hills: shaded, textured and blended
  • Michal Michalski (The Origins of Doha and Qatar Project) – DOHA: Doha Online Historical Atlas
  • eeGeo – Using QGIS to create 3D indoor maps

Doors open from 9:00. Registration shortly thereafter. Start and welcome at 9:45 and a planned finish at 16:30. Geobeers to follow.

Learn More

Editing raster cell values in QGIS using Serval plugin

Users can directly edit raster cell values using Serval plugin in QGIS.

How to use Serval

Serval is available from QGIS plugin repository. Note that you will need to restart QGIS if you upgrade Serval from an earlier version.

Once installed, Serval functions and settings will be available from the toolbar.

Serval Toolbar in QGIS

Serval supports Undo/Redo for editing values of raster. But it is recommended to make a copy of your raster.

Currently, the following functionalities are available:

  • Probe mode Displays raster bands values in boxes.
  • Draw mode Draw/Edit mode: bands values can be modified in the boxes and written to the current raster cell by hitting the Enter key. In this mode the values will be also assigned to any other raster cell clicked by user.
  • Write nodata To replace a cell value with the NODATA value.
  • Define nodata To define or replace the NODATA value.
  • Color picker To pick a color using QGIS color picker (3-bands rasters only).
  • Undo Redo To Undo/Redo the cell edit. Edits history is saved separately for each raster, that is, undo/redo is always done for current raster layer.

Future developments

We’d like to add support to edit values using spatial and expression selection tools.

For any problems or feedback, please consider to file a ticket here.

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

How to effectively get things changed in QGIS – a follow up

Last week I posted regarding some thoughts I’ve had recently concerning what I perceive as a general confusion about how QGIS is developed and how users can successfully get things to change in the project. The post certainly started a lot of conversation! However, based on feedback received I realise some parts of the posts were being misinterpreted and some clarification is needed. So here we go…

1. Please keep filing bug reports/feature requests

I don’t think I was very clear about this – but my original post wasn’t meant to be a discouragement from filing bug reports or feature requests. The truth is that there is a LOT of value in these reports, and if you don’t file a report then the QGIS team will never be aware of the bug or your feature idea. Here’s some reasons why you SHOULD file a report:

  • QGIS developers are a conscientious mob, and generally take responsibility for any regressions they’ve caused by changes they’ve made. In other words, there’s very much an attitude of “I-broke-it, I’ll-fix-it” in the project. So, if a new feature is buggy or has broken something else then filing bugs ASAP is the best way to make the developer aware of these issues. In my experience they’ll usually be addressed rapidly.
  • As mentioned in the original post – there’s always a pre-release bug fix sprint, so filing a bug (especially if it’s a critical one) may mean that it’s addressed during this sprint.
  • Filing feature requests can gain traction if your idea is innovative, novel, or interesting enough to grab a developer’s attention!

Speaking for myself, I regularly check new incoming tickets (at least once a day), and I know I’m not the only one. So filing a report WILL bring your issue to developer’s attention. Which leads to…

2. Frustration is understandable!

I can honestly understand why people get frustrated and resort to an aggressive “why hasn’t this been fixed yet?!” style reply. I believe that these complaints are caused because people have the misunderstanding that filing a bug report is the ONLY thing they can do to get an issue fixed. If filing a report IS the only avenue you have to get something fixed/implemented, then it’s totally understandable to be annoyed when your ticket gets no results. This is a failing on behalf of the project though – we need to be clearly communicating that filing a report is the LEAST you can do. It’s a good first step, but on its own it’s just the beginning and needs to be followed up by one of the methods I described in the initial post.

3. It applies to more than just code

When I wrote the original piece I focused on just the code aspect of the QGIS project. That’s only because I’m a developer and it’s the area I know best. But it applies equally across the whole project, including documentation, translations, infrastructure, websites, packaging QGIS releases, etc. In fact, some of these non-code areas are the best entry points into the project as they don’t require a development background, and eg the documentation and translation teams have done a great job making it easy to submit contributions. Find something missing in the QGIS documentation? Add it yourself! Missing a translation of the website which prevents QGIS adoption within your community? Why not sponsor a translator to tackle this task?!

4. It applies to more than just QGIS!

Again, I wrote the original piece focusing on QGIS because that’s the project I’m most familiar with. You could just as easily substitute GDAL, GEOS, OpenLayers, PostGIS, Geoserver, R, D3, etc… in and it would be equally valid!

Hopefully that helps clarify some of the points raised by the earlier article. Let’s keep the discussion flowing – I’d love to hear if you have any other suggestions or questions raised by this topic.

 

 

 

 

Learn More

How to effectively get things changed in QGIS

I’ve been heavily involved in the open source QGIS mapping project for a number of years now. During this time I’ve kept a close watch on the various mailing lists, issue trackers, stackexchange, tweets and other various means users have to provide feedback to the project. Recently, I’ve started to come to the conclusion that there’s a lot of fundamental confusion about how the project works and how users can get changes made to the project. Read on for these insights, but keep in mind that these are just my thoughts and not reflective of the whole community’s views!..

Firstly – QGIS is a community driven project. Unlike some open source projects (and unlike the proprietary GIS offerings) there is no corporate backer or singular organisation directing the project. This means two things:

  1. The bad news: No-one will do your work for you. QGIS has been created through a mix of user-led contributions (ie, users who have a need to change something and dive in and do it themselves) and through commercially supported contributions (either organisations who offer commercial QGIS support pushing fixes because their customers are directly affected or because they’ve been contracted by someone to implement a particular change). There HAS been a number of volunteer contributions from developers who are just donating their time (for various reasons), but these contributions are very much the minority.
  2. The good news: YOU have the power to shape the project! (And whenever I say “you” – I’m referring directly to the person reading this, or the company you work for. Just pretend it’s in 24 point bold red blinking text.) Because QGIS is community driven (and not subject to the whims of any one particular enterprise) every user has the ability to implement changes and fixes in the program.

So how exactly can users get changes implemented in QGIS? Well, let’s take a look at all the possible different ways that changes get made and how effective each one is:

  1. YOU can make the changes yourself. This implies that you have the c++/Python skills required to make the changes, are able to find your way around the source code, and push through the initial hurdles of setting up a build environment and navigating git. This can be a significant time investment, but the ultimate result is that you can make whatever changes you want, and so long as your pull request is accepted you’ll get your changes directly into QGIS. You’ll find the QGIS team is very open to new contributors and will readily lend a hand if you need assistance navigating the source or for advise on the best way to make these changes. Just ask!
  2. YOU (or your employer) can pay (or “sponsor”) someone to make the changes on your behalf. Reinvesting some of those savings you’re making through using an open source program back into the program itself is a great idea, and everyone benefits. There’s numerous organisations who specialise in QGIS development (eg… my own consultancy, North Road). You can liaise with these organisations to get them to make the changes on your behalf. This is probably the most effective way of getting changes implemented. These organisations all have a history with QGIS development and this experience generally translates to much faster development then if you code it yourself. It’s also somewhat of a shortcut – if you hire a core QGIS developer to make your changes, then you can be confident that they are familiar with the coding style, policies, and long-term goals of the project and accordingly can get the changes accepted rapidly. The obvious down side of paying for changes is that, well, it costs money. Understandably, not everyone has the resources available to do this.
  3. Following on from option 2 – if you can’t directly sponsor changes yourself, you could help indirectly raise funds to pay for the changes. This is a great way to get changes implemented, because everyone has the power to do this. You could seek out similar organisations/users who have the same need and pool your resources, get involved with the local QGIS user group and raise funds together, organise a crowd-funding campaign, etc.
  4. Ask a developer to make the changes for you. This is not terribly effective – you’re basically asking someone to work for free, and take time away from their family/job/hobbies/social life to do work for you. That said, it does sometimes happen, and here’s a few reasons I can think of why:
    • You’ve build up enough “karma” within the project through other contributions. If someone has been heavily involved in the non-development side of the project (eg translations, documentation, helping users out on mailing lists/stackexchange, organising hackfests or user groups, etc) then developers are much more likely to want to help them out in turn.
    • You’ve got a fantastic idea which has just never occurred to anyone before. By bringing it to the attention of a developer you might trigger the “wow, I could really benefit from that too!” impulse which is hard-wired into some of us!
    • It’s a particularly interesting or challenging problem, and sometimes developers just like to extend themselves.
  5. (For bugs only) File a bug report, and hope it gets picked up in one of the pre-release bug fixing sprints. This is basically the same as option 2 – expect that in this case someone else (the QGIS steering committee) is paying for the development time. There’s no way of guaranteeing that your bug will get fixed during this time though, so it’s not a particularly reliable approach if the fix is critical for you.

Finally, there’s two more very ineffective approaches:

  1. File a bug report/feature request, and wait. This isn’t very effective, because what you’re doing is basically the same as 1-4 above, but just waiting for someone else to either do the work or sponsor the changes. This might happen in a week, or might take 10 years.
  2. Complain about something and hope for the best. This is… not very effective. No-one is particularly motivated to help out someone who is being a jerk.

That’s it. Those are the ONLY ways changes get made in QGIS. There’s no other magical short-cuts you can take. Some of these approaches are much more effective than others, and some require skills or resources which may not be available. If you want to see something change in QGIS, you need to take a look at these options and decide for yourself which best meets your needs. But please, just don’t choose option 7!

Update: a follow up to this article was published

Learn More

Crayfish 2.3: New features

Crayfish 2.3 is out with FLO-2D format support and automatic export of contours

Support for new formats

We added support for FLO-2D result files.

FLO-2D format in Crayfish

Weather Research and Forecasting Model (WRF) outputs are now fully supported in Crayfish.

Export contours

Users can now directly generate vector contours from a Crayfish layer. The export-to-contour feature allows you to select type of contour (e.g. line or area contour) and contour intervals. A very handy option is that the current colour ramp can be also used for your contour intervals.

Exporting contours in Crayfish

Processing toolbox Crayfish provider

We have incorporated many algorithms from Crayfish to processing toolbox (Export grid, Export mesh elements, …). To activate the Crayfish module, from the main menu, select Processing > Options and in the new window, under Providers > Crayfish algorithms select the option for Activate.

Exporting contours in Crayfish

With the processing toolbox, user can create batch geo-processing algorithms to automate their work. For example, you can create a batch process using this module, to export several Crayfish grids to rasters.

Export to animation using the Processing Toolbox is not supported yet.

Future developments

We’d like to add support for mesh generation and also mesh calculator. If these are something of you or your organisation interest and would like to contribute financially, feel free to get in touch.

For any problems or feedback, please consider to file a ticket here.

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

Introducing First Aid Plugin

Software development often consists of a brief period of pure excitement while writing the bulk of the source code, followed by a long and dreaded period of finding bugs and fixing them. This scheme is no different when writing plugins for QGIS.

Because we also write QGIS plugins ourselves, we were thinking of how to ease the pain of getting rid of bugs – and so we ended up creating the First Aid plugin, now available in the official QGIS plugin repository.

It is meant to be a Swiss army knife for QGIS plugin developers, a tool that allows easy inspection of any Python code running within QGIS. This is important because it can potentially save developers a lot of their valuable time.

How many times did you end up adding “print” statements into the code to find out what was going wrong in your code? With First Aid plugin this should be no longer necessary.

Error Handler

So let me explain what does it do. First of all, it comes with an improved Python error handler. What this means is that whenever an error occurs in code of a plugin, a window with all the details comes up.

Previously in QGIS you could only find out what was the exception’s type, message and stack trace. First Aid plugin adds source code view, variables view and even an embedded Python console where you can further inspect the state of the plugin at the time of the error. Here is how it looks like in action:

Error Handler Screenshot

Debugger

Plugins however do not always come up with errors that can be caught and handled by QGIS. More often plugins simply do not behave as one would expect them to. Here is when people usually resort to using debuggers. There are IDEs like PyDev or PyCharm - or even standalone tools like Winpdb - that allow developers to do remote debugging. Basically they can connect to the Python environment within QGIS and debug the code there. Personally, I have never been a big fan of this approach and found remote debugging cumbersome to set up and use. And trying to debug something on a client’s computer is even a greater challenge.

First Aid fortunately integrates a debugger into QGIS environment. This allows developers to simply open the debugger window, load some Python files, set breakpoints and everything is ready. Once QGIS reaches a line with a breakpoint, the debugger window will be activated and it is possible to step through the code and inspect the variables to understand what is going on in the code.

Debugger Screenshot

The great thing is that once the execution of Python code is stopped, it is possible to step into code, step over, step out or run to cursor, just like in any other debugger. It is also possible to run custom scripts from within debugger window – they will be also run in debug mode.

Debugging is active only while the debugger window is still open. While debugging, there is some extra overhead when running any Python code (even for code that you do not intend to debug), so it is better to close the debugger when not needed.

The plugin has already helped us various times to quickly identify problems in plugins. Having said that, please note that the plugin is still quite young and may not work perfectly in all cases. We would be happy to hear your feedback. Any issues or pull requests on GitHub would be greatly appreciated!

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