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.

  • 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, 2019 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, 2019 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, 2019 at 19:07
  • @StevenKay, @csk - Another screen shot here. other tags is of Type = QString, Type name = String. Jun 26, 2019 at 0:05

1 Answer 1


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

In a nutshell, in order to use an OSM tag named tag:

  • If the tag is a column in its own right, use tag
  • Otherwise, use hstore_to_map(other_tags)['tag']

For your use case, hstore_to_map(other_tags)['power'] is not null should do the trick.

  • 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, 2021 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.