I'm using CartoCSS together with an OSM Postgres DB (hstore on). I want to set the line color depending on the operator tag of relations (routes). How can I do that?
Thanks to Paul Norman for showing how to include tags only in hstore. As Andre Joost points out, for the operator tag that's not necessary, because it's already included with the default osm2psql config.
Doing some more research, I could dig deeper into the problem and with some surprise found out that there's a divergence between the documentation on http://wiki.openstreetmap.org/wiki/Osm2pgsql/schema and my DB instance.
It says: planet_osm_line: This table contains all non-closed ways which were imported. Additional rows are created for ways which are members of type=route relations. ... The osm_id is the negative ID of the relation
While there are rows with negative osm_id's in the DB, I could not find such an entry for 2 randomly tested ways, e.g. for http://www.openstreetmap.org/way/280802857. As you can see, this way is a member of a relation (3731203) fulfilling the mentioned requirements.
Now I'm not sure if that's the source of my problem. I don't know if that osm2pgsql doc is up to date and I don't know if mapnik uses this DB entries with negative osm_id to evaluate relation tags. But I would guess so.
As a quick fix I manually added a column to the planet_osm_line table with the info I need. But I'd prefer to get rid of that hack asap.
Any hints how to proceed?