How to check in Overpass if route and route_master have different tags?

I’m trying to fix routes where tags like network and operator differ between type=route and type=master_route relations with the same ref (and obviously within the same region) but I couldn’t figure out how to filter routes with inconsistent tags.

The query I’m searching should output both type=master_route and their corresponding type=route. A nice bonus is if said query would also allow me to find inconsistencies between two type=route with the same ref.

Edit: I’m talking about public transportation routes, local lines, to be precise.

As a hint, having different operator tags does not necessarily need “fixing”, for long distance routes it is common to have different operators. Also looking only at “ref” and finding different parts of the same relation can well be intentional, e.g. because the route is split into parts for different operators. Other than “route_master”, the “superroute” type might also merit a look. (not sure whether you are after public transport or hiking/cycling routes).

Since the route should be contained in the route_master, you can adapt this example query.

You don’t need to check for ref= in them. This can be assumed in the =route_master as correct.

rel({{bbox}})[route=train] -> .children;
rel(br.children) -> .parent;
  rel.children(r.this) -> .thischildren;
  (.this; .thischildren;) -> .both;
  if (both.u(t["operator"]) == "< multiple values found >" || both.u(t["network"]) == "< multiple values found >" || thischildren.u(t["operator"]) == "< multiple values found >" || thischildren.u(t["network"]) == "< multiple values found >")
    .both out geom;

(I tested it with equal case)
u() generates a unique output. It returns this message if they aren’t equal.


These checks and some more are also provided by PTNA. Is your area already covered/handled there? Adding that isn’t a problem for me.

Btw. DE-SN-VMS shows around 11 route_masters with ref=A in different cities/villages but with same network value and some of them with same operator. It was some work to write the (Perl) code to handle that.

Maintaining PTNA I’ve seen lots of “incorrect” taging of ref in routes versus route_masters. I don’t claim to decide what is actually correct and what is not. PTNA does not complain for instance if

  • ref = 1;2 for the route_master
  • ref = 1 for it’s first route
  • ref = 2 for it’s second route

If the local mappers say so in PTNA’s CSV list of exiting routes