QGIS – Applying Filter on Local OSM PBF File

filteropenstreetmappbfqgis

Because I sometimes need to work without an internet connection, I use OpenStreetMap data by downloading regional data from https://download.geofabrik.de/ as "Australia_latest.osm.pbf", then applying osmconvert and a batch file to get the subset of interest.

Then I open the resulting osm file in QGIS using the open vector and selecting the osm file. This works fine and opens the various sub-sets into a group as shown here.

enter image description here

I can make a selection of certain objects, for example, as shown with a criterion of "other_tags" ilike '%wa%'.

However, I cannot apply a filter- each and every attempt gives the error message:

"An error occurred when executing the query, please check the
expression syntax".

As below.

enter image description here

This happens with any and every filter expression- even those that work as selection criteria.

I know there are many questions about querying OSM data and I have looked at most of these and their answers. In particular, this question suggests that what I want to do should be possible: Attribute table in QGIS showing a subset of desired features after query builder

So what am I doing wrong? I'm using 3.24.2 on a Windows 10 platform.

Best Answer

Testing a filter on OSM layers results in this error, but the filter runs okay when you hit OK.

I notice OSM layers also don't display the number of features when you select "Show Feature Count" in the layers, which might be related since the filter test probably has to work out the feature count first (to show how many features got filtered).

Have pinged @qgis on Twitter, and I'm also getting deja-vu on this like I've seen it before, so it may be a known issue.

Am on:

QGIS version 3.24.0-Tisler GDAL/OGR version 3.0.4

Related Question