1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
x
 
[out:json][timeout:180];
 
// Get Interstate route relations
rel["network"="US:I"]->.interstates;
rel.interstates;
out count;
 
// Recurse down to member ways
way(r.interstates);
make total length=sum(length())/1609.344;
out;
 
// Filter to unidirectional routes
rel.interstates["direction"]->.unidirectional;
rel.unidirectional;
out count;
 
// Recurse down to member ways
way(r.unidirectional);
make unidirectional length=sum(length())/1609.344;
out;
 
// Filter to bidirectional routes
rel.interstates[!"direction"]->.bidirectional;
way(r.bidirectional);
make bidirectional length=sum(length())/1609.344;
out;
 
// Recurse down to member ways with cardinal directions as roles
(
  way(r.bidirectional:"north");
  way(r.bidirectional:"south");
  way(r.bidirectional:"east");
  way(r.bidirectional:"west");
)->.roled;
way.roled;
make roled length=sum(length())/1609.344;
out;
 
// Recurse up to bidirectional routes that have members with cardinal directions as roles
(
  rel.bidirectional(bw.roled:"north");
  rel.bidirectional(bw.roled:"south");
  rel.bidirectional(bw.roled:"east");
  rel.bidirectional(bw.roled:"west");
);
out count;
500 km
Leaflet © OpenStreetMap contributors
1
 
no data loaded yet