3

I'm trying to complete the seemingly basic task of a filter select for a layer of OSM data pulled from https://download.openstreetmap.fr/extracts/africa/. It's an .osm.pbf which I added to my project as a vector layer. The file is 21.7MB.

The layer's attribute table contains an 'other_tags' column. In that column, some rows include the word 'power'; e.g.

  • "frequency"=>"50","cables"=>"3","voltage"=>"110000","power"=>"line"
  • "power"=>"generator","generator:source"=>"hydro"

I simply want to select all rows with "power" in this field. This should be the query:

other_tags LIKE '%power%'

I've also tried:

"other_tags" LIKE '%power%'
other_tags ILIKE '%power%'
"other_tags" ILIKE '%power%'
other_tags IS '%power%'
"other_tags" IS '%power%'

This is driving me crazy. I've read the QGIS docs and numerous Posts on StackExhange, so beginning to wonder if it's a QGIS bug.

4
  • 1
    How are you importing this into QGIS? For example osm2shp, osm2pgsql, ogr2ogr, or something else? This looks like an hstore field... If you're storing in postgres you might need to use special operators to query the existence of tags. Can you check the field type of 'other_tags' in the layer properties, is that field of type string?
    – Steven Kay
    Jun 21 '19 at 22:00
  • 1
    @StevenKay - I'm simply doing an Add Vector Layer of the .osm.pbf file direct into QGIS. The attribute table looks like this. Jun 21 '19 at 23:23
  • A screenshot of the attribute table doesn't tell us what the field types are. You can check the field type in the layer properties.
    – csk
    Jun 25 '19 at 19:07
  • @StevenKay, @csk - Another screen shot here. other tags is of Type = QString, Type name = String. Jun 26 '19 at 0:05
0

This webpage explains the reason why QGIS expression doesn't work and a solution for it: Using OSM Data in QGIS

1
  • This is a link-only answer: you should add the main message the linked site contributes to the problem. If the link is dead, the solution will be lost.
    – Babel
    Aug 31 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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