Related Plugins and Tags

QGIS Planet

Getting started with pygeoapi processes

Today’s post is a quick introduction to pygeoapi, a Python server implementation of the OGC API suite of standards. OGC API provides many different standards but I’m particularly interested in OGC API – Processes which standardizes geospatial data processing functionality. pygeoapi implements this standard by providing a plugin architecture, thereby allowing developers to implement custom processing workflows in Python.

I’ll provide instructions for setting up and running pygeoapi on Windows using Powershell. The official docs show how to do this on Linux systems. The pygeoapi homepage prominently features instructions for installing the dev version. For first experiments, however, I’d recommend using a release version instead. So that’s what we’ll do here.

As a first step, lets install the latest release (0.16.1 at the time of writing) from conda-forge:

conda create -n pygeoapi python=3.10
conda activate pygeoapi
mamba install -c conda-forge pygeoapi

Next, we’ll clone the GitHub repo to get the example config and datasets:

cd C:\Users\anita\Documents\GitHub\
git clone https://github.com/geopython/pygeoapi.git
cd pygeoapi\

To finish the setup, we need some configurations:

cp pygeoapi-config.yml example-config.yml  
# There is a known issue in pygeoapi 0.16.1: https://github.com/geopython/pygeoapi/issues/1597
# To fix it, edit the example-config.yml: uncomment the TinyDB option in the server settings (lines 51-54)

$Env:PYGEOAPI_CONFIG = "F:/Documents/GitHub/pygeoapi/example-config.yml"
$Env:PYGEOAPI_OPENAPI = "F:/Documents/GitHub/pygeoapi/example-openapi.yml"
pygeoapi openapi generate $Env:PYGEOAPI_CONFIG --output-file $Env:PYGEOAPI_OPENAPI

Now we can start the server:

pygeoapi serve

And once the server is running, we can send requests, e.g. the list of processes:

curl.exe http://localhost:5000/processes

And, of course, execute the example “hello-world” process:

curl.exe --% -X POST http://localhost:5000/processes/hello-world/execution -H "Content-Type: application/json" -d "{\"inputs\":{\"name\": \"hi there\"}}"

As you can see, writing JSON content for curl is a pain. Luckily, pyopenapi comes with a nice web GUI, including Swagger UI for playing with all the functionality, including the hello-world process:

It’s not really a geospatial hello-world example, but it’s a first step.

Finally, I wan’t to leave you with a teaser since there are more interesting things going on in this space, including work on OGC API – Moving Features as shared by the pygeoapi team recently:

So, stay tuned.

[Case Study] Innovating road research and construction

Discover how BRRC revolutionized their field survey workflows with Mergin Maps, enhancing productivity and data accuracy. Learn how their partnership with Lutra Consulting enabled tailored solutions for seamless integration, transforming road research and construction projects.

3.2.0 - Congo

Changes

qfield32

🚀 Features

  • Project-defined tracking sessions activated on project load
  • Background push and synchronization for cloud projects
  • Automatically push pending changes to the cloud on a regular interval
  • New undo/redo functionality allowing you to reverse undesired digitizing and feature editing
  • Title and copyright decoration overlay on top of the map canvas

✨ Improvements

  • Better progress feedback when downloading and synchronizing cloud projects
  • Visual indicators of ‘newer’ cloud project available on the server in QField
  • Relationship’s children can now be created prior to saving their parent feature
  • Insure positioning precise view (i.e. stake-out) works on compass-less devices
  • User interface polishing, including a brand new main menu layout
  • Support for gpsd-served NMEA streams over TCP/UDP
  • Updated several underlying libraries, including QGIS (v3.36) and Qt (v6.6.2)

🤖 Android improvements

  • Massive re-work of native camera, gallery, and file opening activities unlocking proper OS activity overlay

[Case Study] Designing surveys for fibre optics rollout

Jacops was starting a new project for the fiber rollout and needed the tools to organise a national survey. Previously they had used tools provided by a partner and needed to find a solution that allowed them to manage the full scope of the project.

Trajectools 2.0 released 🎉

It’s my pleasure to share with you that Trajectools 2.0 just landed in the official QGIS Plugin Repository.

This is the first version without the “experimental” flag. If you look at the plugin release history, you will see that the previous release was from 2020. That’s quite a while ago and a lot has happened since, including the development of MovingPandas.

Let’s have a look what’s new!

The old “Trajectories from point layer”, “Add heading to points”, and “Add speed (m/s) to points” algorithms have been superseded by the new “Create trajectories” algorithm which automatically computes speeds and headings when creating the trajectory outputs.

“Day trajectories from point layer” is covered by the new “Split trajectories at time intervals” which supports splitting by hour, day, month, and year.

“Clip trajectories by extent” still exists but, additionally, we can now also “Clip trajectories by polygon layer”

There are two new event extraction algorithms to “Extract OD points” and “Extract OD points”, as well as the related “Split trajectories at stops”. Additionally, we can also “Split trajectories at observation gaps”.

Trajectory outputs, by default, come as a pair of a point layer and a line layer. Depending on your use case, you can use both or pick just one of them. By default, the line layer is styled with a gradient line that makes it easy to see the movement direction:

while the default point layer style shows the movement speed:

How to use Trajectools

Trajectools 2.0 is powered by MovingPandas. You will need to install MovingPandas in your QGIS Python environment. I recommend installing both QGIS and MovingPandas from conda-forge:

(base) conda create -n qgis -c conda-forge python=3.9 
(base) conda activate qgis
(qgis) mamba install -c conda-forge qgis movingpandas

The plugin download includes small trajectory sample datasets so you can get started immediately.

Outlook

There is still some work to do to reach feature parity with MovingPandas. Stay tuned for more trajectory algorithms, including but not limited to down-sampling, smoothing, and outlier cleaning.

I’m also reviewing other existing QGIS plugins to see how they can complement each other. If you know a plugin I should look into, please leave a note in the comments.

Save the date & call for contributions: QGIS user conference and contributor meeting in Bratislava

We are happy to announce that QGIS User Conference will take place on 9-10 September 2024 in Bratislava, Slovakia.


The traditional Contributor Meeting will be held right after the conference on 11-13 September 2024 at the same venue.

Learn more about the user conference and the contributor meeting at the event’s web site: https://uc2024.qgis.sk/

The call for papers for the user conference is now open – you can submit proposals for talks and workshops by 31 March 2024:
https://uc2024.qgis.sk/call-for-papers/

We have also started call for sponsors, with sponsorship opportunities at various levels. More details here:
https://uc2024.qgis.sk/sponsors/

User Conference

The QGIS User Conference is an annual event that brings together users and developers of QGIS. The conference provides an opportunity for attendees to learn about the latest developments in QGIS, share their experiences with others, and network with other QGIS users and
developers.

Contributor Meeting

QGIS Contributor Meetings are volunteer-driven events where contributors to the QGIS project from around the world get together in a common space – usually a university campus. During these events, contributors to the QGIS project take the opportunity to plan their work, hold face-to-face discussions and present new improvements to the QGIS project that they have been working on. Everybody attending the event donates their time to the project for the days of the event.
As a project that is built primarily through online collaboration, these meetings provide a crucial ingredient to the future development of the QGIS project. The event is planned largely as an ‘unconference’ with minimal structured programme planning.

For more details and to sign up, please visit the corresponding wiki page https://github.com/qgis/QGIS/wiki/27th%E2%80%90Contributor%E2%80%90Meeting%E2%80%90in%E2%80%90Bratislava

QGIS Grants #9: Call for Grant Proposals 2024

Dear QGIS Community,

We are very pleased to announce that this year’s round of grants is now available. The call is open to anybody who wants to make a contribution to QGIS funded by our grant fund, subject to the call conditions outlined in the application form.

The deadline for this round is in four weeks, on 14 March 2024.

There are no new procedures in 2024. Please note the following guidelines established in previous years: 

  • The proposal must be submitted as a ‘QEP’ (QGIS Enhancement Proposal) issue in the repo: https://github.com/qgis/QGIS-Enhancement-Proposals (tagged as Grant-2024). Following this approach will allow people to ask questions and provide public feedback on individual proposals.
  • Proposals must clearly define the expected final result so that we can properly assess if the goal of the proposal has been reached.
  • The project budgets should account for PR reviewing expenses to ensure timely handling of the project-related PRs and avoid delays caused by relying on reviewer volunteer time. 
  • In the week after the QEP discussion period, the proposal authors are expected to write a short summary of the discussion that is suitable for use as a basis on which voting members make their decisions. 

The PSC of QGIS.ORG will examine the proposals and has veto power in case a proposal does not follow guidelines or is not in line with project priorities.

For more details, please read the introduction provided in the application form.

We look forward to seeing all your great ideas for improving QGIS!

[Blog] Hello from Mergin Maps!

Mergin Maps is a QGIS-powered field survey tool designed to collect data from the field. It is developed by Lutra Consulting, a longstanding contributor, developer, supporter and trainer within the QGIS community.

Hello world!

Welcome to WordPress. This is your first post. Edit or delete it, then start writing!

Software quality in QGIS

According to the definition of software quality given by french Wikipedia

An overall assessment of quality takes into account external factors, directly observable by the user, as well as internal factors, observable by engineers during code reviews or maintenance work.

I have chosen in this article to only talk about the latter. The quality of software and more precisely QGIS is therefore not limited to what is described here. There is still much to say about:

  • Taking user feedback into account,
  • the documentation writing process,
  • translation management,
  • interoperability through the implementation of standards,
  • the extensibility using API,
  • the reversibility and resilience of the open source model…

These are subjects that we care a lot and deserve their own article.

I will focus here on the following issue: QGIS is free software and allows anyone with the necessary skills to modify the software. But how can we ensure that the multiple proposals for modifications to the software contribute to its improvement and do not harm its future maintenance?

Self-discipline

All developers contributing to QGIS code doesn’t belong to the same organization. They don’t all live in the same country, don’t necessarily have the same culture and don’t necessarily share the same interests or ambitions for the software. However, they share the awareness of modifying a common good and the desire to take care of it.

This awareness transcends professional awareness, the developer not only has a responsibility towards his employer, but also towards the entire community of users and contributors to the software.

This self-discipline is the foundation of the quality of the contributions of software like QGIS.

However, to err is human and it is essential to carry out checks for each modification proposal.

Automatic checks

With each modification proposal (called Pull Request or Merge Request), the QGIS GitHub platform automatically launches a set of automatic checks.

Example of proposed modification

Result of automatic checks on a modification proposal

The first of these checks is to build QGIS on the different systems on which it is distributed (Linux, Windows, MacOS) by integrating the proposed modification. It is inconceivable to integrate a modification that would prevent the application from being built on one of these systems.

The tests

The first problem posed by a proposed modification is the following “How can we be sure that what is going to be introduced does not break what already exists?”

To validate this assertion, we rely on automatic tests. This is a set of micro-programs called tests, which only purpose is to validate that part of the application behaves as expected. For example, there is a test which validates that when the user adds an entry in a data layer, then this entry is then present in the data layer. If a modification were to break this behavior, then the test would fail and the proposal would be rejected (or more likely corrected).

This makes it possible in particular to avoid regressions (they are very often called non-regression tests) and also to qualify the expected behavior.

There are approximately 1.3 Million lines of code for the QGIS application and 420K lines of test code, a ratio of 1 to 3. The presence of tests is mandatory for adding functionality, therefore the quantity of test code increases with the quantity of application code.

In blue the number of lines of code in QGIS, in red the number of lines of tests

There are currently over 900 groups of automatic tests in QGIS, most of which run in less than 2 seconds, for a total execution time of around 30 minutes.

We also see that certain parts of the QGIS code – the most recent – are better covered by the tests than other older ones. Developers are gradually working to improve this situation to reduce technical debt.

Code checks

Analogous to using a spell checker when writing a document, we carry out a set of quality checks on the source code. We check, for example, that the proposed modification does not contain misspelled words or “banned” words, that the API documentation has been correctly written or that the modified code respects certain formal rules of the programming language.

We recently had the opportunity to add a check based on the clang-tidy tool. The latter relies on the Clang compiler. It is capable of detecting programming errors by carrying out a static analysis of the code.

Clang-tidy is, for example, capable of detecting “narrowing conversions”.

Example of detecting “narrowing conversions”

In the example above, Clang-tidy detects that there has been a “narrowing conversion” and that the value of the port used in the network proxy configuration “may” be corrupted. In this case, this problem was reported on the QGIS issues platform and had to be corrected.

At that time, clang-tidy was not in place. Its use would have made it possible to avoid this anomaly and all the steps which led to its correction (exhaustive description of the issue, multiple exchanges to be able to reproduce it, investigation, correction, review of the modification), meaning a significant amount of human time which could thus have been avoided.

Peer review

A proposed modification that would validate all of the automatic checks described above would not necessarily be integrated into the QGIS code automatically. In fact, its code may be poorly designed or the modification poorly thought out. The relevance of the functionality may be doubtful, or duplicated with another. The integration of the modification would therefore potentially cause a burden for the people in charge of the corrective or evolutionary maintenance of the software.

It is therefore essential to include a human review in the process of accepting a modification.

This is more of a rereading of the substance of the proposal than of the form. For the latter, we favor the automatic checks described above in order to simplify the review process.

Therefore, human proofreading takes time, and this effort is growing with the quantity of modifications proposed in the QGIS code. The question of its funding arises, and discussions are in progress. The QGIS.org association notably dedicates a significant part of its budget to fund code reviews.

More than 100 modification proposals were reviewed and integrated during the month of December 2023. More than 30 different people contributed. More than 2000 files have been modified.

Therefore the wait for a proofreading can sometimes be long. It is also often the moment when disagreements are expressed. It is therefore a phase which can prove frustrating for contributors, but it is an important and rich moment in the community life of a free project.

To be continued !

As a core QGIS developer, and as a pure player OpenSource company, we believe it is fundamental to be involved in each step of the contribution process.

We are investing in the review process, improving automatic checks, and in the QGIS quality process in general. And we will continue to invest in these topics in order to help make QGIS a long-lasting and stable software.

If you would like to contribute or simply learn more about QGIS, do not hesitate to contact us at [email protected] and consult our QGIS support proposal.

(Fr) Rencontres QGIS-fr – Grenoble 27 & 28 mars 2024

Sorry, this entry is only available in French.

Designing QGIS Cloud QWC2 with CSS

In an earlier post, I showed how it is possible to permanently position a legend in the QGIS Cloud map as part of a QGIS Cloud Pro subscription. To achieve this, the appearance of the map view was changed using CSS. In this post, I will describe exactly what this is and how it works. The appearance of the QGIS Cloud Web Client is controlled via CSS. CSS stands for Cascading Style Sheets.

New point clouds and mesh features in QGIS 3.36

QGIS 3.36 is round the corner and as usual, there will be several new exciting features with the new release. Below is the list of features our team has added to the new release. This was made possible by generous funding from clients.

Render point clouds as a surface in 2D map views

Point clouds are rendered as individual points by default. Depending on the zoom level and density of the points, you might not be able to get a full picture of the map.

Rendering points as surface enables you to have a better understanding of the data before trying to do any analysis or processing. This has been possible in 3D map views for a couple of QGIS releases, now we have added the functionality also in 2D map views.

The feature generates a surface using triangulation on-the-fly from the points using the same symbology. Below you can see the difference between a point cloud rendered as individual points and rendered as a surface:

Point clouds as surface

Point clouds as individual points vs. as a TIN surface

The good news is that rendering as a surface also works well with global map shading, allowing users to get a nice hillshade:

Point clouds as surface with hillshade with hillshade

Point clouds as surface with hillshade

To enable this feature, you need to check the option for Render as a Surface (Triangulate) under the Layer Styling panel.

Point clouds styling panel

Settings to display point clouds as surface

Pro-tip: if the on-the-fly rendering as a surface takes too long to render, try increasing the Maximum error: for example 0.6 mm instead of the default 0.3 mm.

Flexible styling of classes

Previously, point cloud data visualisation in QGIS was limited to rendering all points with a uniform size and opacity. This made it difficult to differentiate between different point classes and highlight specific features of interest. To address this issue, we have introduced a new feature that allows users to customise the point size and opacity for each point cloud data class. This provides a flexible way for visualising point cloud data, allowing users to highlight specific point classes, e.g. by increasing the point size.

Assigning size and opacity to each point cloud class

Assigning size and opacity to each point cloud class

Point clouds with different sizes and opacity levels

Point clouds with different sizes and opacity levels

Set 3D map view extent in 2D map

Effectively navigating and visualising large-scale 3D datasets can be challenging on PCs with limited resources. To address this issue, we introduced a new feature that allows users to interactively limit the 3D scene, enabling them to focus on specific areas of interest. This new feature, conveniently accessible from the toolbar, eliminates the need for tedious manual entry of coordinates for bounding boxes. Instead, users can simply drag and draw a box around the desired area, instantly restricting the 3D scene to that specific extent. This interactive approach significantly enhances the user experience and streamlines the process of exploring and analysing 3D data:

Interactive selection of 3D map scene from 2D map

Interactive selection of 3D map scene from 2D map

Python API for 3D views

Creating and viewing 3D maps in QGIS with the correct camera location and angle, scene tilt, light, and other parameters can be a time-consuming and error-prone process. This is because it requires users to manually adjust these settings, often through trial and error. However, with the introduction of the new 3D map view API in QGIS, Python plugins can now automate this process, making it much easier, consistent and more efficient to create high-quality 3D maps that are visually appealing and informative.

# List all open 3D map canvases
iface.mapCanvases3D()
# [<qgis._3d.Qgs3DMapCanvas object at 0x7f23491b5e10>]
canvas = iface.mapCanvases3D()[0]

Now let’s try something more complicated:

# Let's change some settings!
ms = canvas.mapSettings()
ms.setEyeDomeLightingEnabled(True)
ms.setBackgroundColor(QColor('beige'))
ms.setTerrainMapTheme('dtm')
ms.setFieldOfView(110)

# Move the camera to look at specific map coordinates in layer's CRS
cam = canvas.cameraController()
mapPoint = QgsVector3D(-498175.92, -1205400.58, 210)
worldPoint = ms.mapToWorldCoordinates(mapPoint)
cam.setLookingAtPoint(worldPoint, 60, 45, 100)

# Create four new 3D map views
c1 = iface.createNewMapCanvas3D('South View')
c2 = iface.createNewMapCanvas3D('West View')
c3 = iface.createNewMapCanvas3D('North View')
c4 = iface.createNewMapCanvas3D('East View')

# Apply settings to all open 3D map views
for canvas in iface.mapCanvases3D():
	canvas.mapSettings().setEyeDomeLightingEnabled(True)

# Define a camera pose to update the views' cameras
pose = QgsCameraPose()
pose.setCenterPoint(QgsVector3D(0, 210, 0))  # This is in 3D world coordinates
pose.setDistanceFromCenterPoint(100)
pose.setPitchAngle(75)  # Tilt the camera by 75 degrees
pose.setHeadingAngle(0)  # Looking towards North
c1.cameraController().setCameraPose(pose)
pose.setHeadingAngle(90)  # Towards East
c2.cameraController().setCameraPose(pose)
pose.setHeadingAngle(180)  # Towards South
c3.cameraController().setCameraPose(pose)
pose.setHeadingAngle(270)  # Towards West
c4.cameraController().setCameraPose(pose)

# We can set the 3D map views 2D extent to always match the main 2D canvas one
# Our 3D views get updated while zooming/panning the main 2D canvas
canvas = iface.mapCanvas()
canvas.extentsChanged.connect(lambda :c1.mapSettings().setExtent(canvas.extent()))
canvas.extentsChanged.connect(lambda :c2.mapSettings().setExtent(canvas.extent()))
canvas.extentsChanged.connect(lambda :c3.mapSettings().setExtent(canvas.extent()))
canvas.extentsChanged.connect(lambda :c4.mapSettings().setExtent(canvas.extent()))

Changing 3D view settings through Python

Changing 3D view settings through Python

More point clouds attributes

LAS/LAZ/COPC point clouds have a classificationFlags attribute that stores four types of information (Synthetic, Keypoint, Withheld, and Overlap) in a single value. This saves space, but it makes it difficult to use the information for styling or filtering, as you need to write complex expressions.

To make it easier to use, we are following the approach introduced in PDAL 2.6: the classificationFlags attribute gets replaced with four separate attributes: Synthetic, Keypoint, Withheld, and Overlap. This will make it easier to include these attributes in styling and filtering expressions.

Performance enhancement for rendering

To improve the performance of point cloud rendering in QGIS, we introduced a new caching system to minimise the need for repeated decompression of LAS node data while panning or zooming. This caching mechanism efficiently stores decompressed points for each unique combination of layer URI, node, requested attributes, filter extent, and filter expression. This enables rapid rendering of previously cached nodes, significantly enhancing the overall rendering performance in 2D and 3D maps.

Performance can vary depending on actual data, but on a local sample COPC file, it renders 7 times faster with this change.

Labels for mesh layer

Viewing mesh data has been possible through styling, plotting or using the Identify tool. But now you can also create labels on mesh surfaces or vertices similar to vector layers.

To display labels for your mesh data, simply open the styling panel and enable labels for:

  • Labels on Vertices
  • Labels on Surfaces

Label settings for mesh layers

Label settings for mesh layers

Below is an example of mesh Z values at vertices (yellow) and mesh areas at cell centre (purple):

Example of labels on a mesh layer

Example of labels on a mesh layer

Want more changes in QGIS?

Do you want to see more improvements and new features in QGIS? Do not hesitate to contact us to discuss your requiremnets.

Finding geospatial accounts on Mastodon

Besides following hashtags, such as #GISChat, #QGIS, #OpenStreetMap, #FOSS4G, and #OSGeo, curating good lists is probably the best way to stay up to date with geospatial developments.

To get you started (or to potentially enrich your existing lists), I thought I’d share my Geospatial and SpatialDataScience lists with you. And the best thing: you don’t need to go through all the >150 entries manually! Instead, go to your Mastodon account settings and under “Import and export” you’ll find a tool to import and merge my list.csv with your lists:

And if you are not following the geospatial hashtags yet, you can search or click on the hashtags you’re interested in and start following to get all tagged posts into your timeline:

[Changelog] Enhanced synchronization performance and stability

The mobile app 2.5.0 contains multiple synchronization fixes and enhancements. Enjoy faster and more reliable file transfers!

[Changelog] Enhanced feature identification speed

In our latest update, we've turbocharged the speed of feature identification on the map! Enjoy a faster and more responsive experience as you navigate and identify features with efficiency.

[Changelog] Enhanced viewing: zoom feature now available in the mobile app

In our latest mobile app update, we've added an enhanced viewing feature that allows users to smoothly zoom in and out of images. This new functionality provides a more detailed and flexible viewing experience, letting you focus on intricate details or take in the big picture with ease. Navigate your visual data with precision and control!

[Changelog] Reset local changes from QGIS

With Mergin Maps QGIS Plugin 2024.1 you can now revert local changes of your QGIS project. Click on synchronise button in the toolbar and in the “Project status” dialog you will see new button to “Reset Changes”

Read the full changelog of the release: https://github.com/MerginMaps/qgis-plugin/releases/tag/2024.1

[Changelog] Position tracking is now available

I am pleased to announce that position tracking 📡 has been released today as part of Mobile version 2.3.0 and Plugin version 2023.3.

You can learn more about the tracking feature and how to set it up by visiting: https://merginmaps.com/docs/field/tracking/

Enjoy the tracking, and please let us know your thoughts! If you encounter any issues, please don’t hesitate to contact us.

[Case Study] Improving wildfire prevention and firefighting readiness

David Galloway works as a volunteer with the Wallcliffe Volunteer Fire Brigade in Western Australia. Volunteer brigades are the front line of firefighting and prevention across the State.

  • Page 1 of 136 ( 2705 posts )
  • >>

Back to Top

Sustaining Members