Filter points by distance using a QGIS model

Low code solutions and ETL seem to be in demand these days, so it seemed natural to use a QGIS processing model for today´s task: filter points by distance from another feature. I wanted to find points within 2 km of a specific highway (E 20, Sweden) and I wanted to automate the task. It can easily be done manually, but those days are over. Some of the main advantages of using a model are:

  • They are easy to build and understand, especially if you add comments and groups.
  • The process is clearly documented, as you can see all of the steps for processing the data.
  • It´s easy to change or improve the model later on.

I used OpenStreetMap data for the road network and the points, downloaded as SHP files from https://download.geofabrik.de/. The model looks like this:

A few notes:

  • As always, add comments and groups to organize your model.
  • If you want to add the result to your project window, add a name for the output in the algorithm. As seen above, you can do this while also using the output in an algorithm downstream.
  • Remove as much unwanted data as early as possible in the model. In this model, I used filtering and clipping.
  • The models runs are fast and stable, but QGIS tends to forget which layers to use, so this has to be picked each time you want to run the model.
  • If you can, use the newest possible version of QGIS, as this part of the program is polished for each release.

You can download the model from GitHub.

Related articles:

Leave a Reply

Your email address will not be published. Required fields are marked *

Please reload

Please Wait