From the file osm.pbf I created a shape that contains lines of a street network and attributes for 'lanes'.

Problem: The attribute 'lanes' is combined with many others in a column "other_tags".

After doing some research, I found that PostgreSQL and the hstore extension can filter individual attributes (documentation).

I want all OSM IDs and their corresponding values ​​for "lanes".


  other_tags :: hstore -> 'lanes'

comes unknown operator.

Do I still have to set something specific to use hstore?


Have you tried other_tags::hstore -> 'lanes' (without spaces) ?

The :: is to CAST your column in hstore format. It is the equivalent to CAST(other_tags AS hstore).

If your field other_tags is already in hstore format, use other_tags -> 'lanes'.

If you want all OSM IDs and the corresponding attribute, create a query like :

  other_tags::hstore -> 'lanes' AS lanes_value

The WHERE clause is to filter the results and must return True or False (boolean).

e.g. :

  • WHERE id < 10
  • WHERE other_tags::hstore -> 'lanes' = 'bus'.
  • now this error message appears: "ERROR: WHERE argument must have type boolean, not type text LINE 2: where other_tags :: hstore -> 'lanes'"
    – hugo
    Jan 24 '20 at 11:49
  • @hugo: see my post edit. Jan 24 '20 at 12:24
  • now this error message appears: ERROR: FEHLER: Unexpected end of string SQL state: XX000 It looks something systemic. I'm using pgAdmin 4.
    – hugo
    Jan 24 '20 at 12:35
  • Can you retry without the spaces around the :: ? Jan 24 '20 at 12:40
  • unfortunately no change
    – hugo
    Jan 24 '20 at 12:42

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.