I have a table with the columns of id,tags(hstore data type) and geometry. I want to categorize the table based on selecting the specific key form tags: for example:
select * FROM table_name WHERE tags @> 'public_transport=>stop_position'
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
Solution with QGIS 2.18
You need the plugin 'Expressions plus'. Then you can perform queries on a hstore-column.
If you choose 'Categorized' and use an expression-based column you can categorize values within a certain key:
For QGIS 3 I haven't found a way to perform that
You can't use HSTORE operators in standard QGIS expression like that.
However if your back-end database is Postgres, and you have installed the HSTORE extension (to ensure your operators like => are defined) then you may be able to use them in Database Manager SQL queries.
Alternatively, if that doesn't work, then a Postgres query that uses a CASE statement to allocate these values to a new column in your table would work. (Or you could create a new MATERIALIZED VIEW using the same technique)