QGIS Planet

LLM-based spatial analysis assistants for QGIS

After the initial ChatGPT hype in 2023 (when we saw the first LLM-backed QGIS plugins, e.g. QChatGPT and QGPT Agent), there has been a notable slump in new development. As far as I can tell, none of the early plugins are actively maintained anymore. They were nice tech demos but with limited utility.

However, in the last month, I saw two new approaches for combining LLMs with QGIS that I want to share in this post:

IntelliGeo plugin: generating PyQGIS scripts or graphical models

At the QGIS User Conference in Bratislava, I had the pleasure to attend the “Large Language Models and GIS” workshop presented by Gustavo Garcia and Zehao Lu from the the University of Twente. There, they presented the IntelliGeo Plugin which enables the automatic generation of PyQGIS scripts and graphical models.

The workshop was packed. After we installed all dependencies and the plugin, it was exciting to test the graphical model generation capabilities. During the workshop, we used OpenAI’s API but the readme also mentions support for Cohere.

I was surprised to learn that even simple graphical models are actually pretty large files. This makes it very challenging to generate and/or modify models because they take up a big part of the LLM’s context window. Therefore, I expect that the PyQGIS script generation will be easier to achieve. But, of course, model generation would be even more impressive and useful since models are easier to edit for most users than code.

Image source: https://github.com/MahdiFarnaghi/intelli_geo

ChatGeoAI: chat with PyQGIS

ChatGeoAI is an approach presented in Mansourian, A.; Oucheikh, R. (2024). ChatGeoAI: Enabling Geospatial Analysis for Public through Natural Language, with Large Language Models. ISPRS Int. J. Geo-Inf.13, 348.

It uses a fine-tuned Llama 2 model in combination with spaCy for entity recognition and WorldKG ontology to write PyQGIS code that can perform a variety of different geospatial analysis tasks on OpenStreetMap data.

The paper is very interesting, describing the LLM fine-tuning, integration with QGIS, and evaluation of the generated code using different metrics. However, as far as I can tell, the tool is not publicly available and, therefore, cannot be tested.

Image source: https://www.mdpi.com/2220-9964/13/10/348

Are you aware of more examples that integrate QGIS with LLMs? Please share them in the comments below. I’d love to hear about them.

Learn More

3.4.3 - Ebo

What's Changed

  • Prevent feature form crash with blob attributes
  • Fix regression with cloud project's synchronize and push buttons sometimes not responsive to clicks
  • Fix multi-line handling of expressions within QML / HTML editor widgets
  • Fix regression with value relation editor widget search bar not reacting to keystrokes with a number of virtual keyboards
  • Update translations (thanks to our growing group of contributors!)
Learn More

[Changelog] Layer feature lists now follow QGIS sorting rules

The app now respects QGIS sorting rules when listing features from a specific layer. Navigate to “Layers -> select a layer”, and the feature list will follow the sorting set in QGIS. Sorting can be set in QGIS by clicking a column to toggle between ascending or descending order, or set a custom sort expression through the popup menu. The sorting order is saved in the QGIS project file and will be automatically applied in the app.

Learn More

[Changelog] Order entries in value relation widget

We’ve added support for ordering entries by value in value relation widgets. To enable this feature, simply check the option in the QGIS layer’s attribute form configuration. Once selected, the list will automatically be sorted by value. See the screenshot below for details.

Learn More

Catching up with the QGIS User Conference 2024 & Save the Date for 2025

This year’s user conference took place in Bratislava, organized by the Slovak QGIS User Group and hosted at the Slovak University of Technology Faculty of Civil Engineering. The event was sold out early and the venue was full of energy and excitement.

If you missed the conference or couldn’t make it to a talk due to too many great overlapping sessions, you now have the opportunity to catch up with everything on the UC 2024 playing list:

Thanks to the organizers, speakers, sponsors, and all participants for the wonderful event.

If you want to read some personal reports from community members, here’s Ujaval Gandhi’s report: https://spatialthoughts.com/2024/09/14/qgis-user-conference-2024; and here’s Hans van der Kwast’s: https://www.qwast-gis.com/l/qgis-user-conference-2024/

Last but not least, we want you to save the date for next year’s user conference:

The QGIS User Conference will be in Norrköping, Sweden from 2-3 June 2025, and contributor meeting there after 4-7.

Learn More

3.4.2 - Ebo

What's Changed

  • Fix variable scoping error with relation editor widgets
  • Enable WebSockets support in QField to benefit plugin authors
  • Fix regression whereas feature multi-editing can lead to crash
  • Some (micro) optimizations of feature form
  • Fix crash occurring when the internal receiver is request permission while immediately replaced with external receiver on launch
  • Insure that QField toasts appear above the virtual keyboard
  • Fix missing + IMU in the quality description
  • Allow for users to see and send NMEA logs produced by QField
Learn More

[Changelog] Explore the enhanced performance of Maps 🛠️

Visit maps in a project detail to experience improved performance. We're continuously working to make them more efficient and reliable.

Learn More

Trajectools tutorial: trajectory preprocessing

Today marks the release of Trajectools 2.3 which brings a new set of algorithms, including trajectory generalizing, cleaning, and smoothing.

To give you a quick impression of what some of these algorithms would be useful for, this post introduces a trajectory preprocessing workflow that is quite general-purpose and can be adapted to many different datasets.

We start out with the Geolife sample dataset which you can find in the Trajectools plugin directory’s sample_data subdirectory. This small dataset includes 5908 points forming 5 trajectories, based on the trajectory_id field:

We first split our trajectories by observation gaps to ensure that there are no large gaps in our trajectories. Let’s make at cut at 15 minutes:

This splits the original 5 trajectories into 11 trajectories:

When we zoom, for example, to the two trajectories in the north western corner, we can see that the trajectories are pretty noisy and there’s even a spike / outlier at the western end:

If we label the points with the corresponding speeds, we can see how unrealistic they are: over 300 km/h!

Let’s remove outliers over 50 km/h:

Better but not perfect:

Let’s smooth the trajectories to get rid of more of the jittering.

(You’ll need to pip/mamba install the optional stonesoup library to get access to this algorithm.)

Depending on the noise values we chose, we get more or less smoothing:

Let’s zoom out to see the whole trajectory again:

Feel free to pan around and check how our preprocessing affected the other trajectories, for example:

Learn More