This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

How to restrict ways between two nodes? (e.g. rails between two train stations)

0

Hi,
I want to restrict my search on Overpass Turbo to ways between 2 train stations. I have the UIC reference of the two stations, now I am only interested about the rails that connect the two stations.
So I first look for the relations between the two stations, but that already gives me all relations of both stations. So I first like to restrict to only the relations going through both of these 2 train stations.
Next I want only the ways along these relations between the two train stations.

Here is my code so far:

[out:json][timeout:25];      
{{geocodeArea:Zurich}}->.searchArea;      
(        
  node[uicref=8503011]["railway"="station"];    
  node[uicref=8503000]["railway"="station"];    
  rel(bn);       
  way(r)(area.searchArea);   
);     
out body;    
>;         
out skel qt;

asked 20 Aug '20, 11:28

Roger's gravatar image

Roger
11113
accept rate: 0%

edited 20 Aug '20, 16:57

1

Please double check your code. It's returning empty.

(20 Aug '20, 11:43) DaveF

One Answer:

0

Try this:

[out:json][timeout:25];   
{{geocodeArea:Zurich}}->.searchArea;    
(    
  node[uic_ref=8503011]["railway"="station"];  
  node[uic_ref=8503000]["railway"="station"];  
  rel(bn)(area.searchArea);  
  way(r)(area.searchArea);  
);      
out body;    
>;      
out skel qt;

PS: I am interested only in the ways from Bhf. Wiedikon to HB Zürich, respectively the ways from the two nodes referenced by uic_ref above:

Bhf. Wiedikon to HB Zürich

answered 20 Aug '20, 16:48

Roger's gravatar image

Roger
11113
accept rate: 0%

edited 20 Aug '20, 16:57

Source code available on GitHub .