Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

route_name tag #315

Closed
pnorman opened this issue Mar 17, 2015 · 4 comments
Closed

route_name tag #315

pnorman opened this issue Mar 17, 2015 · 4 comments

Comments

@pnorman
Copy link
Collaborator

pnorman commented Mar 17, 2015

A user on IRC was confused why names for route relations were not appearing in their osm2pgsql database. So was I, until I found

tagtransform.cpp:113

if (is_route && (p->key == "name"))
  tags.addItem("route_name", p->value, true);

https://trac.openstreetmap.org/ticket/1703 is related, but I don't believe it is relevant anymore.

It may have been relevant if relying on catchalls with osm.xml, but isn't relevant to any recent stylesheet.

The lua transforms do not do this.

It is undocumented.

Should we still be doing this?

This does not impact openstreetmap-carto.

cc @Tommyf

@lonvia
Copy link
Collaborator

lonvia commented Mar 21, 2015

The special handling for routes is rather old. The original commit is here and was done for the cycle map, I believe. It was never used by the mapnik style. @gravitystorm should know more details.

I suspect that a lot of maps that handle route relations still rely on this code. If we want to phase this out, it has to be long term thing (with announcements on dev@ etc.) and we should provide a lua style that emulates the old behaviour. Personally, I'm more for just leaving the C transform as is with all it's quirks, concentrate on making the lua tagtransform more efficient and promote that in the future.

@pnorman
Copy link
Collaborator Author

pnorman commented Jul 2, 2015

ping @gravitystorm

Would it cause problems if the name column was populated in addition to the route_name column?

The relevant code is

for (keyval *p = rel_tags->firstItem(); p; p = rel_tags->nextItem(p)) {
     //copy the name tag as "route_name"
     if (is_route && (p->key == "name"))
         tags.addItem("route_name", p->value, true);
     //copy all other tags except for "type"
     else if (p->key != "type")
         tags.addItem(p->key, p->value, true);
 }

I'd do this by changing the else if to an if

@gravitystorm
Copy link
Contributor

I think the original intention was to have the name of the underlying way clearly distinct from the name of the route relation, hence the different tags. Or I think it might have been a way to access routes before route= tagging of relations was common, e.g. "select * from planet_osm_ways where route_name is not null" but take that with a pinch of salt.

Of course, getting access to properties of underlying ways when dealing with route relations (e.g. is this part of the relation off-road, on a bridge, etc) is still a dark art and I've no idea of the current output for route relations in osm2pgsql.

So make whatever changes you think are appropriate!

@pnorman
Copy link
Collaborator Author

pnorman commented Jul 2, 2015

Of course, getting access to properties of underlying ways when dealing with route relations (e.g. is this part of the relation off-road, on a bridge, etc) is still a dark art

The C transforms don't do this, but there is #230 open about adding the ability to do this in Lua.

and I've no idea of the current output for route relations in osm2pgsql.

Assuming default.style, they get populated in the line table, but not the roads table. For a road relation, they are like route=road ref=123. If you added the columns, they'd also generally have a network value and a route_name value if the relation has a name=* tag. Unless there was a tagging error, they would not have a highway=* tag. If there was a tagging error and highway=* was on the relation, the road would end up being rendered twice, as with gravitystorm/openstreetmap-carto#302

pnorman added a commit to pnorman/osm2pgsql that referenced this issue Jul 4, 2015
The C transforms used to turn the name tag into a route_name tag on
route relations, for reasons that are not entirely clear. This change
doesn't remove route_name, but does also populate the name column,
eliminating a source of confusion to users.

Fixes osm2pgsql-dev#315
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants