Related Plugins and Tags

QGIS Planet

2.5.0 - Fancy Flamingo

🚀 New features

25

  • Elevation profiling of terrain and layers (#3501)
  • Multi-column support in feature form (#3518)
  • Measuring tool display azimuth values (#3503)
  • Locked screen mode to avoid accidental touches while QField is in your pocket (#3507)
  • Customize number of items shown in the feature form’s relation editor widget (#3520)

Improvements

  • Handling of feature form group’s background color
  • Improved viewing resolution of GeoPDFs and georeferenced PDFs datasets
  • Font sizing on Windows, Linux, and MacOS
  • NULL state for the feature form’s checkbox widget
  • New feature handling of default values improved to match QGIS behavior

🐛 Bug fixes

  • Fix default value relying on positioning variables updated on feature edits
  • Fix external GNSS receiver’s ellipsoidal elevation regression
  • More feature form-related bugs addressed, simply too many to list

Plugin Update October 2022

The QGIS plugin repository currently lists 1728 plugins and the list keeps on growing. October has been busy with 15 new plugins. It can be challenging to stay up to date.

Our monthly plugin update is meant to provide you a quick overview of the newest plugins. If any of the names or short descriptions piques your interest, you can find the direct link to the plugin page in the table below the screenshot.

Query Tool
The plugin is used to extract clusters (Tie) on shapefile issue for the Pavemetrics inspections systems.
NextGIS IdentifyPlus
Extended identify tool. Show photos and other attachments stored in your Web GIS right in QGIS. Developed by NextGIS.
MapBiomas Collection Official
This plugin lets you add the anual land use and land cover maps from the MapBiomas Project (http://mapbiomas.org/) as a collection of WMS layer.
FLINTpro Datacheck
This plugin is designed for FLINTpro users to easily check the compatibility of data for uploading to FLINTpro.
Selection Sets Reloaded
Plugin for saving and loading selection sets for layers.
Deepness: Deep Neural Remote Sensing
Inference of deep neural network models (ONNX) for segmentation, detection and regression
Create points on arcs’ intersection
The plugin creates a new layer with points on arcs’ intersection within the same layer
Download data from IBGE
This plugin downloads data from IBGE
QGIS-GMSH
This is a plugin to interract with the GMSH mesh generator (see http://geuz.org/gmsh).
Replace Geometry
Replaces a geometry keeping the attributes unchanged
SensorThings API
The plugin enables QGIS to access dynamic data from sensors, using SensorThings API protocol (https://www.ogc.org/standards/sensorthings)
Fast Field Filler
The plugin was created to quickly fill in the fields in the attribute table.
Nearest Neighbor Method for Linear Features (NNMLF)
This plugin estimates the spatial distribution pattern of linear features.
NDFF Connector Plugin
This connector uses the NDFF-Connector library to create all needed configuration and settings to connect to the NDFF api, to upload Observations/Waarnemingen
Zone Label
This plugin allows to split and manually label rectangular areas.

SLYR Update — November 2022

Our SLYR tool is the complete solution for full compatibility between ArcMap, ArcGIS Pro and QGIS. It offers a powerful suite of conversion tools for opening ESRI projects, styles and other documents directly within QGIS, and for exporting QGIS documents for use in ESRI software.

A lot has changed since our last SLYR product update post, and we’ve tons of very exciting improvements and news to share with you all! In this update we’ll explore some of the new tools we’ve added to SLYR, and discuss how these tools have drastically improved the capacity for users to migrate projects from the ESRI world to the open-source world (and vice versa).

ArcGIS Pro support

The headline item here is that SLYR now offers a powerful set of tools for working with the newer ArcGIS Pro document formats. Previously, SLYR offered support for the older ArcMap document types only (such as MXD, MXT, LYR, and PMF formats). Current SLYR versions now include tools for:

Directly opening ArcGIS Pro .lyrx files within QGIS

LYRX files can be dragged and dropped directly onto a QGIS window to add the layer to the current project. All the layer’s original styling and other properties will be automatically converted across, so the resultant layer will be an extremely close match to the original ArcGIS Pro layer! SLYR supports vector layers, raster layers, TIN layers, point cloud layers and vector tile layers. We take great pride in just how close the conversion results are to how these layers appear in ArcGIS Pro… in most cases you’ll find the results are nearly pixel perfect!

In addition to drag-and-drop import support, SLYR also adds support for showing .lyrx files directly in the integrated file browser, and also adds tools to the QGIS Processing Toolbox so that users can execute bulk conversion operations, or include document conversion in their models or custom scripts.

ArcGIS Pro map (mapx) and project (aprx) conversion

Alongside the LYRX support, we’ve also added support for the ArcGIS Pro .mapx and .aprx formats. Just like our existing .mxd conversion, you can now easily convert entire ArcGIS Pro maps for direct use within QGIS! SLYR supports both the older ArcGIS Pro 2.x project format and the newer 3.x formats.

Export from QGIS to ArcGIS Pro!

Yes, you read that correctly… SLYR now allows you to export QGIS documents into ArcGIS Pro formats! This is an extremely exciting development… for the first time ever QGIS users now have the capacity to export their work into formats which can be supplied directly to ESRI users. Current SLYR versions support conversion of map layers to .lyrx format, and exporting entire projects to the .mapx format. (We’ll be introducing support for direct QGIS to .aprx exports later this year.)

We’re so happy to finally provide an option for QGIS users to work alongside ArcGIS Pro users. This has long been a pain point for many organisations, and has even caused organisations to be ineligible to tender for jobs which they are otherwise fully qualified to do (when tenders require provision of data and maps in ArcGIS compatible formats).

ArcGIS Pro .stylx support

Alongside the other ArcGIS Pro documents, SLYR now has comprehensive support for reading and writing ArcGIS Pro .stylx databases. We’ve dedicated a ton of resources in ensuring that the conversion results (both from ArcGIS Pro to QGIS and from QGIS to ArcGIS Pro) are top-notch, and we even handle advanced ArcGIS Pro symbology options like symbol effects!

Take a look below how even very advanced ArcGIS Pro style libraries convert beautifully to QGIS symbol libraries:

ArcMap Improvements

While we’ve been focusing heavily on the newer ArcGIS Pro formats, we’ve also improved our support for the older ArcMap documents. In particular, SLYR now offers more options for converting ArcMap annotation layers and annotation classes to QGIS supported formats. Users can now convert Annotation layers and classes directly over to QGIS annotation layer or alternatively annotation classes can be converted over to the OGC standard GeoPackage format. When exporting annotation classes to GeoPackage the output database is automatically setup with default styling rules, so that the result can be opened directly in QGIS and will be immediately visualised to match the original annotation class.

Coming soon…

While all the above improvements are already available for all SLYR license holders, we’ve got many further improvements heading your way soon! For example, before the end of 2022 we’ll be releasing another large SLYR update which will introduce support for exporting QGIS projects directly to ArcGIS Pro .aprx documents. We’ve also got many enhancements planned which will further improve the quality of the converted documents. Keep an eye on this blog and our social media channels for more details as they are available…

You can read more about our SLYR tool at the product page, or contact us today to discuss licensing options for your organisation.

 

Creating circular insets and other fun QGIS layout tricks

Thanks to the recent popularity of the “30 Day Map Challenge“, the month of November has become synonymous with beautiful maps and cartography. During this November we’ll be sharing a bunch of tips and tricks which utilise some advanced QGIS functionality to help create beautiful maps.

One technique which can dramatically improve the appearance of maps is to swap out rectangular inset maps for more organic shapes, such as circles or ovals.

Back in 2020, we had the opportunity to add support for directly creating circular insets in QGIS Print Layouts (thanks to sponsorship from the City of Canning, Australia!). While this functionality makes it easy to create non-rectangular inset maps the steps, many QGIS users may not be aware that this is possible, so we wanted to highlight this functionality for our first 30 Day Map Challenge post.

Let’s kick things off with an example map. We’ve shown below an extract from the 2032 Brisbane Olympic Bid that some of the North Road team helped create (on behalf of SMEC for EKS). This map is designed to highlight potential venues around South East Queensland and the travel options between these regions:

Venue Masterplan Brisbane 2032 Olympics
Venue Masterplan for 2032 Olympic Games, IOC Feasibility Assessment – Olympic Games, Brisbane February 2021

Circles featured heavily in previous Olympic bid maps (such as Budapest) where we took our inspiration from. This may, or may not, play a part in using the language of the target map audience – think Olympic rings!

Budapest Olympics 2024 MasterplanBudapest Olympics 2024 Masterplan

 

Step by Step Guide to Creating a Circle Inset

Firstly, prepare a print layout with both a main map and an inset map. Make sure that your inset map is large enough to cover your circular shape:

From the Print Layout toolbar, click on the Add Shape button and then select Add Ellipse:

Draw the ellipse over the middle of your inset map (hint: holding down Shift while drawing the ellipse will force it to a circular shape!). If you didn’t manage to create an exact circle then you can manually specify the width and height in the shape item’s properties. For this one, we went with a 50mm x 50mm circle:

Next, select the Inset Map item and in its Item Properties click on the Clipping Settings button:

In the Clipping Settings, scroll down to the second section and tick the Clip to Item box and select your Ellipse item from the list. (If you have labels shown in your inset map you may also want to check the “force labels inside clipping shape” option to force these labels inside the circle. If you don’t check this option then labels will be allowed to overflow outside of the circle shape.)

Your inset map will now be bound to the ellipse!

Here’s a bit more magic you could add to this map – in the Main Map’s properties, click on Overviews and set create one for the Inset map – it will nicely show the visible circular area and not the rectangle!

Bonus Points: Circular Title Text!

For advanced users, we’ve another fun tip…and when we say fun, we mean ‘let’s play with radians’! Here we’re going to create some title text and a wedged background which curves around the outside of our circular inset. This takes some fiddly playing around, but the end result can be visually striking! Here we’re going to push the QGIS print layout “HTML” item to create some advanced graphics, so some HTML and CSS coding experience is advantageous. (An alternative approach would be to use a vector illustration application like Inkscape, and add your title and circular background as an SVG item in the print layout).

We’ll start by creating some curved circular text:

First, add a “HTML frame” to your print layout:

HTML frames allow placement of dynamic content in your layouts, which can use HTML, CSS and JavaScript to create graphical components.

In the HTML item’s “source” box, add the following code:

<svg height="300" width="350">
        <defs>
            <clipPath id="circleView">
                <circle id="curve" cx="183" cy="156" r="25" fill="transparent" />
            </clipPath>
        </defs>
        <path id="forText" d="M 28,150, C 25,50, 180,-32,290,130" stroke="" fill="none"/>
            <text x="0" y="35" width="100">
                <textpath xlink:href="#forText">
                    <tspan font-weight="bold" fill="black">Place text here</tspan>
                </textpath>
            </text>
             <style>
    <![CDATA[
      text{
        dominant-baseline: hanging;
        font: 20px Arial;
      }
    ]]>
  </style>
</svg>

Now, let’s add in a background to bring more focus onto the title!

To add in the background, create another HTML item. We’ll again create the arc shape using an SVG element, so add the following code into the item’s source box:

<svg width="750" height="750" xmlns="http://www.w3.org/2000/svg">
  <path d="M 90 70
           A 56 56, 0, 0, 0, 133 140
           L 150 90 Z" fill="#414042" transform=" scale(2.1) rotate(68 150 150) " />/>
</svg>

(You can read more about SVG  curves and arcs paths over at MDN)

So there we go! These two techniques can help push your QGIS map creations further and make it easier to create beautiful cartography directly in QGIS itself. If you found these tips useful, keep an eye on this blog as we post more tips and tricks over the month of November. And don’t forget to follow the 30 day Map Challenge for a smorgasbord of absolutely stunning maps.

Best of Swiss Enterprise App Award for QField

What a night it was. The “Best of Swiss Apps Awards” took place in Zurich yesterday, November 2, 2022. We were also nominated with QField. And in the enterprise category, the app was so convincing, that it was awarded the highest possible price. So it brought the award “Best of Swiss Enterprise App” home to Graubünden. And as cherry on the cake: QField was also nominated as finalist in the UX/UI category!

We are extremely proud and happy about the received award. And even more when we look at the contendants that won in the other categories. We’re talking companies like SBB, Swiss Life, Switzerland Tourism and, yes, Rivella ?.

You can check out all results at https://www.bestofswissapps.ch/bosa/hall-of-fame

If you are interested in more details, we released a press release in German and in English.

QField is an open source mobile app. The app is designed to use and edit geographically referenced data. In urban environments with 5G connectivity, but also with offline data. The mobile GIS app combines minimal design for simplicity with sophisticated technology for a versatile range of uses to bring data conveniently from the field to the offices. The app was started in 2011 and received a major rebuild in 2022.

QField is mainly funded by customer feature requests, support contracts and sponsoring and is continuously improved an released for Android, iOS, Windows, MacOS and Linux.

It offers a seamless QGIS integration and is GPS-centric, with offline functionality, synchronisation options and desktop configuration. QField is designed for fieldwork: simple, but uncompromising. The app is used internationally and is the first choice for mobile GIS projects. In the city, in the countryside and in the forest.

Soon, QFieldCloud will also be launched. QFieldCloud is a cloud service integrated into QField that enables the remote provision and synchronisation of geodata and projects.

And here some moments of the award night. It was a blast!

2.4.5 - Ecstatic Elk

Changes

🐛 Bug Fixes

  • Fix startup crash on iOS 16.1
  • Fix QField-specific variables failure when features have default values set to apply on update

Waste Sampling in the Digital Era - Case of the Czech Republic

Mergin Maps and QGIS used for municipal waste composition survey in the Czech Republic.

Global Environmental Threat of Municipal Waste

The dumping of municipal waste is a global threat to our environment and all life forms.

Currently, there is a distinct trend of less landfilling, as countries move steadily towards alternative ways of recycling and incineration, where material use is not possible.

Dr Martin Pavlas, Associate Professor at the Institute of Process Engineering in the Faculty of Mechanical Engineering at Brno University of Technology in the Czech Republic, is doing important research as part of an EU project regarding municipal waste sampling.

Photo of bins, M. Pavlas

Bins to be sampled (Photo: M. Pavlas)

With the aid of Mergin Maps and QGIS, he is carrying out an extensive municipal waste composition survey in the Czech Republic. Together with Peter Petrik of Lutra Consulting, a unique GIS-based tool was developed for the waste sampling. This includes a prototype mobile application based on Mergin Maps for waste sampling in the field.

Read the full article on merginmaps.com

QGIS 3.28 Firenze is released!

We are pleased to announce the release of QGIS 3.28 ‘Firenze’!

Installers for all supported operating systems are already out. QGIS 3.28 comes with tons of new features, as you can see in our visual changelog. QGIS 3.28 Firenze is named after this year’s FOSS4G host city.

We would like to thank the developers, documenters, testers and all the many folks out there who volunteer their time and effort (or fund people to do so). From the QGIS community we hope you enjoy this release! If you wish to donate time, money or otherwise get involved in making QGIS more awesome, please wander along to qgis.org and lend a hand!

QGIS is supported by donors and sustaining members. A current list of donors who have made financial contributions large and small to the project can be seen on our donors list. If you would like to become a sustaining member, please visit our page for sustaining members for details. Your support helps us fund our six monthly developer meetings, maintain project infrastructure and fund bug fixing efforts.

QGIS is Free software and you are under no obligation to pay anything to use it – in fact we want to encourage people far and wide to use it regardless of what your financial or social status is – we believe empowering people with spatial decision making tools will result in a better society for all of humanity.

Successful crowdfunding campaign - point cloud 3

We are pleased to announce the success of the fund raising campaign, thanks to the great response from the QGIS community. We will publish the full list of the backers soon.

The project will introduce point cloud processing to QGIS and further enhance profile tool and 3D maps. The new processing tools will allow you to create terrain/contours from your point cloud data, handle and manage large datasets and several other processing algorithms. In addition, we intend to allow you to embed profiles in your print layouts, export to other formats (e.g. DXF, CSV) and more improvements to the elevation profile tool. For more details see the crowdfunding page.

The work will start soon in collaboration with the excellent teams from North Road and Hobu. To stay up to date with progress, you can follow this blog or monitor QGIS code repository. If you would like to test the new features and provide us with your feedback, you can install QGIS nightly/master.

2.4.4 - Ecstatic Elk

Changes

🐛 Bug Fixes

  • Fix non-atlas printing to PDF (via the main menu)
  • Avoid falling into an endless loop of default value updates

2.4.3 - Ecstatic Elk

Changes

Usability improvements

  • Added a documentation button in the 'About QField' popup linking to our growing documentation site.

🐛 Bug Fixes

  • Fixed search bar's go to point feature partially broken when layer CRS doesn't match the project CRS

2.4.2 - Ecstatic Elk

🐛 Bug fixes

  • Further tweaks to sample projects to have them behave better outside of Europe

High Efficiency with Buffered Transactional Editing in QGIS

Tired of start/stop editing for every single layer in your project with mixed data sources?
Starting from version 3.26, QGIS has a new transaction mode called “Buffered Transaction Groups”.

Within this mode, all layers which are not read-only are put in one “transaction group” and handled together when the actions “Toggle Editing” or “Save Layer Edits” are activated. It doesn’t matter if the layers come from different providers like GeoPackage, PostgreSQL or Shapefile. Edits are buffered locally and saved within one single transaction on all layers per provider. With this, you can store all edited layers with a single click. And in comparison to the well-known “Automatic Transaction Groups” mode you have better performance during editing and fewer problems with locking of the database when multiple users edit the same table in parallel.

To try it out; go to Project -> Properties -> Data Sources -> Transaction mode

Enjoy and let us know what you think!

Limitations:

In databases, transactions are atomic. That is, the data can be completely and correctly written, or it will be completely rolled back. With buffered transactions, QGIS tries to do the same but has less control. When writing to different providers it could happen that, if an error occurs when writing to PostgreSQL, but some data were already written in a Shapefile the rollback will be only partial. This only applies to data from different data sources.

This feature was sponsored by Canton Glarus.

A New Trick up QField’s Sleeve: Animated Maps

Starting with QField 2.2, users can fully rely on animation capabilities that have made their way into QGIS during its last development cycle. This can be a powerful mean to highlight key elements on a map that require special user attention.

The example below demonstrates a scenario where animated raster markers are used to highlight active fires within the visible map extent. Notice how the subtle fire animation helps draw viewers’ eyes to those important markers.

Animated raster markers is a new symbol layer type in QGIS 3.26 that was developed by Nyall Dawson. Supported image formats include GIF, WEBP, and APNG.

The second example below showcases more advanced animated symbology which relies on expressions to animate several symbol properties such as marker size, border width, and color opacity. While more complex than simply adding a GIF marker, the results achieved with data-defined properties animation can be very appealing and integrate perfectly with any type of project.

You’ll quickly notice how smooth the animation runs. That is thanks to OPENGIS.ch’s own ninjas having spent time improving the map canvas element’s handling of layers constantly refreshing. This includes automatic skipping of frames on older devices so the app remains responsive.

Oh, we couldn’t help ourselves but take the opportunity to demonstrate how nice the QField feature form layout is these days in the video above 😄 To know more about other new features in QField 2.2, go and read the release page.

Happy field mapping to all!

The lovely animal markers used in the zoo example above were made by Serbian artist Arsenije Vujovic.

How we build QField for many platforms – A look behind the curtain

In the past year, the build system behind QField has been ported to vcpkg, a modern C++ dependency management system. It has been a great success for QField and considerably helped to streamline efforts, improve the development experience and to guarantee an outstanding stability of the application. In this blog post we will look at the history of building QGIS based applications for mobile systems and how it has become what it is today.

When Marco Bernasocchi (CEO of OPENGIS.ch and chair of QGIS.org) started working on QGIS for Android in Google Summer of Code a decade ago, the main job was to also build all QGIS dependencies for Android. This includes well-known libraries like proj and gdal and less-known ones like libxml2 or iconv. Each of them has its particularities and specific build flags. Working on this appears to be an endless iterative trial-and-error journey where you hope each day that eventually you will see the QGIS splash screen on your Android phone while all you see are endless lines of code and compiler errors.

As we know nowadays QGIS for Android has eventually seen the sunlight and its achievements are still the base for QGIS-based mobile apps like QField.

Sometime later we decided to modernize the build infrastructure into OSGeo4A a set of scripts where each dependency was built with a “recipe”. Modularized this way, it was easier to maintain, and general build code common for all libraries could be isolated. It was good enough to help drive QField for a couple of years, and a copy of it is still in use as the base for nowadays QGIS builds for macOS.

When we decided to make QField also available on other platforms like iOS, Windows and macOS we quickly realized that duplicating build chains scales really bad and maintaining this is an immense effort we wanted to avoid. There are a couple of existing C++ dependency management systems, none of which convinced us ultimately. Lucky for us a mail on the QGIS mailing list mentioned a new one called vcpkg which looked very promising.

A couple of days later we had a build for Windows and later in the same year for macOS. With many dependencies already available in modern versions. Cheers.

What’s left to do than just enable it for Android, and all our problems are suddenly solved? Alas, it’s not so easy. Cross-compiling is always a bit trickier. And so we started another journey to improve the situation. After a while, we had a working build chain based on vcpkg for Android in our R&D labs. Interestingly, this added a couple of features just because the community around vcpkg had already added them. For example using COG-based raster data via HTTP was suddenly working (for the record: thanks to the availability of curl which we never took care of adding ourselves in OSGeo4A).

Soon after we also wanted to try building for iOS with vcpkg, which after a few attempts also was successful, and even managed to resolve some weird crashes and other issues we had experienced with the old buildchain.

The main benefit was that we could upgrade the QGIS base libraries in one single place for every platform, in an isolated branch without playing the Jenga game on each upgrade.

The only unfinished business we still had was that support for iOS and Android was still available only in our own vcpkg fork.

So the last few weeks and months we have been working closely with upstream to bring building for Android and iOS up to the same level as desktop platforms. The relevant parts are now in a clean state.

Advantages of this approach:

  • • Mutualized efforts on all the base libraries, also with programmers outside the geoverse
  • • A vibrant community that ensures a noticeably fast upgrade of libraries
  • • A clean dependency management system
  • • A consistent set of dependency versions (gdal, geos, libpq, …) across all platforms
  • • A clean caching system that will only recompile reverse dependencies on updates
  • • We can upgrade a dependency in an isolated branch and only release it when it works on all platforms
  • • We can optimize the code for a given set of dependency versions and if a bug is fixed in a certain dependency version, we are sure we can ship this fix on all platforms promptly
  • • We maintain the QField source code as well as dependency versions in a single repository, what makes development more streamlined

Big thanks go to Alexander Neumann and Kai Pastor who both stand out for doing things the right and future-proof way.

As always, things come at a price, there was a steep learning curve involved, and some edge cases require attention. However, we are thrilled by the simplification this has brought us.

If you are maintaining a customized fork of QField, it is now a good time to start upgrading to vcpkg, since OSGeo4A has been archived and will no longer be maintained. The developer documentation of QField has been updated with relevant instructions.

If you have time to test the new build system, we will be happy to read about your experiences with it.

Writing a feature-based processing algorithm at the example of M-value interpolation

Amongst all the processing algorithms already available in QGIS, sometimes the one thing you need is missing. 

This happened not a long time ago, when we were asked to find a way to continuously visualise traffic on the Swiss motorway network (polylines) using frequently measured traffic volumes from discrete measurement stations (points) alongside the motorways. In order to keep working with the existing polylines, and be able to attribute more than one value of traffic to each feature, we chose to work with the M-values. M-values are a per-vertex attribute like X, Y or Z coordinates. They contain a measure value, which typically represents time or distance. But they can hold any numeric value.

In our example, traffic measurement values are provided on a separate point layer and should be attributed to the M-value of the nearest vertex of the motorway polylines. Of course, the motorway features should be of type LineStringM in order to hold an M-value. We then should interpolate the M-values for each feature over all vertices in order to get continuous values along the line (i.e. a value on every vertex). This last part is not yet existing as a processing algorithm in QGIS.

This article describes how to write a feature-based processing algorithm based on the example of M-value interpolation along LineStrings.

Feature-based processing algorithm

The pyqgis class QgsProcessingFeatureBasedAlgorithm is described as follows: “An abstract QgsProcessingAlgorithm base class for processing algorithms which operates “feature-by-feature”.  

Feature based algorithms are algorithms which operate on individual features in isolation. These are algorithms where one feature is output for each input feature, and the output feature result for each input feature is not dependent on any other features present in the source. […]

Using QgsProcessingFeatureBasedAlgorithm as the base class for feature based algorithms allows shortcutting much of the common algorithm code for handling iterating over sources and pushing features to output sinks. It also allows the algorithm execution to be optimised in future (for instance allowing automatic multi-thread processing of the algorithm, or use of the algorithm in “chains”, avoiding the need for temporary outputs in multi-step models).

In other words, when connecting several processing algorithms one after the other – e.g. with the graphical modeller – these feature-based processing algorithms can easily be used to fill in the missing bits. 

Compared to the standard QgsProcessingAlgorithm the feature-based class implicitly iterates over each feature when executing and avoids writing wordy loops explicitly fetching and applying the algorithm to each feature. 

Just like for the QgsProcessingAlgorithm (a template can be found in the Processing Toolbar > Scripts > Create New Script from Template), there is quite some boilerplate code in the QgsProcessingFeatureBasedAlgorithm. The first part is identical to any QgsProcessingAlgorithm.

After the description of the algorithm (name, group, short help, etc.), the algorithm is initialised with def initAlgorithm, defining input and output. 

In our M-value example:

    def initAlgorithm(self, config=None):
        self.addParameter(
            QgsProcessingParameterFeatureSource(
                self.INPUT,
                self.tr('Input layer'),
                [QgsProcessing.TypeVectorAnyGeometry]
            )
        )
        self.addParameter(
            QgsProcessingParameterFeatureSink(
                self.OUTPUT,
                self.tr('Output layer')
            )
        )

While in a regular processing algorithm now follows def processAlgorithm(self, parameters, context, feedback), in a feature-based algorithm we use def processFeature(self, feature, context, feedback). This implies applying the code in this block to each feature of the input layer. 

! Do not use def processAlgorithm in the same script, otherwise your feature-based processing algorithm will not work !

Interpolating M-values

This actual processing part can be copied and added almost 1:1 from any other independent python script, there is little specific syntax to make it a processing algorithm. Only the first line below really.

In our M-value example:

    def processFeature(self, feature, context, feedback):
        
        try:
            geom = feature.geometry()
            line = geom.constGet()
            vertex_iterator = QgsVertexIterator(line)
            vertex_m = []

            # Iterate over all vertices of the feature and extract M-value

            while vertex_iterator.hasNext():
                vertex = vertex_iterator.next()
                vertex_m.append(vertex.m())

            # Extract length of segments between vertices

            vertices_indices = range(len(vertex_m))
            length_segments = [sqrt(QgsPointXY(line[i]).sqrDist(QgsPointXY(line[j]))) 
                for i,j in itertools.combinations(vertices_indices, 2) 
                if (j - i) == 1]

            # Get all non-zero M-value indices as an array, where interpolations 
              have to start

            vertex_si = np.nonzero(vertex_m)[0]
            
            m_interpolated = np.copy(vertex_m)

            # Interpolate between all non-zero M-values - take segment lengths between 
              vertices into account

            for i in range(len(vertex_si)-1):
                first_nonzero = vertex_m[vertex_si[i]]
                next_nonzero = vertex_m[vertex_si[i+1]]
                accum_dist = itertools.accumulate(length_segments[vertex_si[i]
                                                                  :vertex_si[i+1]])
                sum_seg = sum(length_segments[vertex_si[i]:vertex_si[i+1]])
                interp_m = [round(((dist/sum_seg)*(next_nonzero-first_nonzero)) + 
                            first_nonzero,0) for dist in accum_dist]
                m_interpolated[vertex_si[i]:vertex_si[i+1]] = interp_m

            # Copy feature geometry and set interpolated M-values, 
              attribute new geometry to feature

            geom_new = QgsLineString(geom.constGet())
            
            for j in range(len(m_interpolated)):
                geom_new.setMAt(j,m_interpolated[j])
                
            attrs = feature.attributes()
            
            feat_new = QgsFeature()
            feat_new.setAttributes(attrs)
            feat_new.setGeometry(geom_new)

        except Exception:
            s = traceback.format_exc()
            feedback.pushInfo(s)
            self.num_bad += 1
            return []
        
        return [feat_new]

In our example, we get the feature’s geometry, iterate over all its vertices (using the QgsVertexIterator) and extract the M-values as an array. This allows us to assign interpolated values where we don’t have M-values available. Such missing values are initially set to a value of 0 (zero).

We also extract the length of the segments between the vertices. By gathering the indices of the non-zero M-values of the array, we can then interpolate between all non-zero M-values, considering the length that separates the zero-value vertex from the first and the next non-zero vertex.

For the iterations over the vertices to extract the length of the segments between them as well as for the actual interpolation between all non-zero M-value vertices we use the library itertools. This library provides different iterator building blocks that come in quite handy for our use case. 

Finally, we create a new geometry by copying the one which is being processed and setting the M-values to the newly interpolated ones.

And that’s all there is really!

Alternatively, the interpolation can be made using the interp function of the numpy library. Some parts where our manual method gave no values, interp.numpy seemed more capable of interpolating. It remains to be judged which version has the more realistic results.

Styling the result via M-values

The last step is styling our output layer in QGIS, based on the M-values (our traffic M-values are categorised from 1 [a lot of traffic -> dark red] to 6 [no traffic -> light green]). This can be achieved by using a Single Symbol symbology with a Marker Line type “on every vertex”. As a marker type, we use a simple round point. Stroke style is “no pen” and Stroke fill is based on an expression:

with_variable(

'm_value', m(point_n($geometry, @geometry_point_num)),

	CASE WHEN @m_value = 6
		THEN color_rgb(140, 255, 159)

		WHEN @m_value = 5
			THEN color_rgb(244, 252, 0)

		WHEN @m_value = 4
			THEN color_rgb(252, 176, 0)

		WHEN @m_value = 3
			THEN color_rgb(252, 134, 0)

		WHEN @m_value = 2
			THEN color_rgb(252, 29, 0)

		WHEN @m_value = 1
			THEN color_rgb(140, 255, 159)

		ELSE
			color_hsla(0,100,100,0)

	END
)

And voilà! Wherever we have enough measurements on one line feature, we get our motorway network continuously coloured according to the measured traffic volume.

One disclaimer at the end: We get this seemingly continuous styling only because of the combination of our “complex” polylines (containing many vertices) and the zoomed-out view of the motorway network. Because really, we’re styling many points and not directly the line itself. But in our case, this is working very well.

If you’d like to make your custom processing algorithm available through the processing toolbox in your QGIS, just put your script in the folder containing the files related to your user profile:

profiles > default > processing > scripts 

You can directly access this folder by clicking on Settings > User Profiles > Open Active Profile Folder in the QGIS menu.

That way, it’s also available for integration in the graphical modeller.

Extract of the Graphical Modeler sequence. “Interpolate M-values neg” refers to the custom feature-based processing algorithm described above.


You can download the above-mentioned processing scripts (with numpy and without numpy) here.

Happy processing!

QField 2.4 is here, and it is ?icious

Yes, QField for QGIS, the leading fieldwork app, was released on the iOS App Store!

Get It now for Android, iOS, MacOS, Windows and Linux

Good things take time (and sponsors), and we wanted our Apple users to enjoy the same solid and seamless experience as our Android users. So we took the time needed and ran beta testing of QField for multiple months. Thanks to all the community feedback and to the uncountable work hours put in by our development team, today we released QField on the iOS Appstore.

Following the naming scheme for the 2.X series, we decided to name QField 2.4 Ecstatic Elk (Cervus Canadensis), honouring “the land of maple leaf ??”, the home country of Mathieu (QField lead UX designer) and origin of some recent funding.

New features, improvements and demo projects

Releasing for iOS is the main news for QField 2.4, but we also added some new features as well as fixed some annoying bugs we had.

New demo projects showing many new QField features. We merged the Bee simple and Bee advanced projects into one bees project and added a wastewater management project that comes with beautiful dark and light themes.

The new features include atlas-driven print layouts that can now be printed through the main menu’s print to PDF item and dragging files onto an iOS device via USB Cable with iTunes support.

Some more UX improvements can be noticed when sending or exporting datasets via the project folder. All sidecars will now be considered so that, for example, you can send your edited shapefiles via your favourite email or messenger app.

Finally, QFieldCloud’s projects are better sorted, and its community tab is now functional.

Bugfixes

During the last sprint, we greatly improved QField’s automated testing framework, greatly decreasing the risks of regressions slipping into future releases. We also ensured that QGIS-shipped SVG markers will now render properly within QField.

Finally, we fixed freehand toggling when using a stylus and ensured the changelog popup doesn’t overlap with the OS’ status bar.

Best of Swiss Apps Nomination

We put a lot of effort into ensuring that QField, is of the highest possible quality, so being nominated as a finalist for the BestOfSwissApps award was even sweeter ???

Beginning of November, we’ll know more about the outcome of the votes ?

QFieldCloud

QFieldCloud has been in Free BETA for half a year now. Thanks to the precious help of the many early adopters (we already have over 30K users), we were able to identify and fix plenty of issues. In the last months, our service status page has been consistently looking super-green 😉

We are extremely happy with how the system is behaving and are even happier with the feedback we are receiving!

As of today, we’ve implemented all the functionality that we want to have for the GA release. All we are missing is finishing testing the billing and payment system and rolling the drums ?

So keep on enjoying our fantastic fieldwork ecosystem, and let us know the amazing things you do with it!

Support QField

We put a lot of effort into ensuring that QField, is of the highest possible quality and invest a lot of developer time in QField, QFieldCloud and QGIS. Plenty of it is sponsored by OPENGIS.ch because we believe in giving back to the OS geo community; part is sponsored by the clients that ask us to develop features, and part is financed through our support contracts that come with a sustainability initiative.

If you think that helping QField is a good thing, go to our donate page to find out more or immediately start sponsoring QField.

2.4.1 - Ecstatic Elk

🐛 Bug fixes

  • Fix settings' external GNSS device combobox out of sync with positioning device on QField launch

2.4.0 - Ecstatic Elk

QField 2.4 is out with a number of new features, usability improvements and bug fixes. This new release also marks the first non-beta version on iOS as QField maturity on the Apple devices has ground over the last few months.

24-censored

🚀 Features

  • Atlas-driven print layouts can now be printed through the main menu’s print to PDF menu
  • Dragging of files onto an iOS device via USB Cable and iTune support
  • First non-beta iOS release available to the public

Usability improvements

  • When sending or exporting datasets via the project folder, all sidecars will be taken into consideration (i.e you can send those edited shapefiles via your favorite email or messenger app)
  • QFieldCloud’s projects are now better sorted and its community tab now functional
  • Improvements to sample projects shipped with QField (have a look!)

🐛 Bug fixes

  • QField greatly improved its automated testing framework, greatly decreasing the risks of regressions slipping into future releases
  • QGIS-shipped SVG markers will now render properly within Qfield
  • Freehand toggling with stylus fixed
  • The changlelog popup doesn't overlap with the OS’ status bar anymore

3rd Crowdfunding on Point Clouds, Elevation Profiles and 3D Map View Enhancements

Lutra Consulting, North Road and Hobu are collaborating in a new crowd-funding campaign to extend these capabilities in future QGIS releases!

Highlights of the planned improvements include:

  • Point Clouds
    Creating point cloud processing tools for transformation, management and analysis of point clouds. Ensuring that extremely large (terabyte size) datasets can be handled well for both display and analysis.
  • Elevation Profiles
    Support embedding customisable elevation profiles into print layouts and atlases, and allow exporting elevation profiles to CSV and DXF.
  • 3D Maps
    Faster 3D maps for large scenes, an improved 3D measurement tool and further improvements to 3D scene navigation.

Your financial support is vital to make these improvements possible! Visit the crowd funding page for additional information on what is included in the effort and how you can financially contribute.

  • <<
  • Page 15 of 141 ( 2807 posts )
  • >>

Back to Top

Sustaining Members