I have added an OpenStreetMap dump file to PostGIS using osm2pgsql --hstore (and the default osm2pgsql style file). I have added and opened up this to TileMill.

Is there anyway to style the map based on the values in the hstore column (tags) in TileMill using only CartoCSS? Or do I have to change the subquery on the layer to 'extract' the hstore column to make it look like a real column?

e.g. pretend I want style based on the OSM wifi tag, which is a key in the hstore tags column. In SQL I could select it with: select * from planet_osm_point where tags->'wifi' = 'yes';. If wifi was a real column, then I could style it in CartoCSS with:

#mylayerid[wifi='yes'] { … }

What would I put in to select based on the tags column?

#mylayerid[?????] { … }

I would like to use TileMill as a server to demo using OSM, and allow people to style based on esoteric/edge cases. These are not very technical people, so I'd like to have it as easy as possible.

1 Answer 1


CartoCSS does not support hstore columns because Mapnik does not support them directly either. The only workaround right now is to extract the keys and values into normal columns in the SQL query. Eg:

( select tags->'wifi' as wifi, way
  from planet_osm_point
  where tags->'wifi' = 'yes'
) as data

To make this easier for non-technical people, you would need to come up with a way to auto-generate such queries/layers.

There is an issue open on the Mapnik issue tracker about adding hstore support, but it does not seem to have much activity.

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.