3

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.

4
  • I get this when I hit "Test", but if I "OK" the filter it seems to apply correctly anyway. Are you getting this on "OK" as well as "Test"? Even if the filter expression box is empty then "Test" complains with this error but "OK" works and the full data set appears. QGIS 3.24.0-Tisler on Linux. (Note your screenshots are a bit low-res and its hard to see the exact details of your query - eg I can't be certain your quote marks are right, but you'd get another error if they weren't)
    – Spacedman
    Commented May 14, 2022 at 7:57
  • and it doesnt happen for a simple temporary points layer, so I'm thinking its something specific to the .osm driverr. Hmmm. Check qgis bug list and report?
    – Spacedman
    Commented May 14, 2022 at 7:59
  • I also see that the Feature Count doesn't work for my OSM file layer, which may be related. I'm using a small OSM file (Liechtenstein) so its not like the driver has decided the data is too big to scan completely. Am not sure if bug or feature... Will ask @qgis on twitter...
    – Spacedman
    Commented May 14, 2022 at 8:07
  • thanks @Spacedman! You are correct- it executes perfectly well by just pressing OK (and I have tried several different queries) so it is only the "test" that is an issue. Serves me right for being ultra-cautious and not just steaming on. Do you want to put up an answer for me to accept? Commented May 14, 2022 at 8:09

1 Answer 1

3

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.