Overpass_queries   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 53
rs 10
c 0
b 0
f 0
wmc 5

5 Functions

Rating   Name   Duplication   Size   Complexity  
A get_route_relations() 0 5 1
A get_area_boundary() 0 2 1
A get_operating_site_separator() 0 2 1
A get_operating_site_area() 0 2 1
A get_ground_floor_tracks() 0 2 1
1
def get_area_boundary() -> str:
2
    return """
3
        [out:json];
4
        
5
        area["ISO3166-1"="HU"]
6
        // area["admin_level"="8"]["name"="Hegyeshalom"]
7
          -> .country;
8
          
9
    """
10
11
12
def get_route_relations() -> str:
13
    # future: replace lines below when https://github.com/drolbr/Overpass-API/issues/146 is closed
14
    #     relation["route"="railway"]["ref"]["operator"~"(^MÁV(?=;))|((?<=;)MÁV(?=;))|((?<=;)MÁV$)"](area.country);
15
    #     relation["route"="railway"]["ref"]["operator"~"(^GYSEV(?=;))|((?<=;)GYSEV(?=;))|((?<=;)GYSEV$)"](area.country);
16
    return """
17
        (
18
            relation["route"="railway"]["ref"]["operator"~"MÁV"](area.country);
19
            relation["route"="railway"]["ref"]["operator"~"GYSEV"](area.country);
20
        );
21
        >>;
22
        out;
23
        
24
    """
25
26
27
def get_operating_site_area(node_id: int) -> str:
28
    return f"""
29
        node({node_id}) -> .station;
30
        .station out;
31
        nwr(around.station:100)["landuse"="railway"];
32
        convert item ::geom=geom();
33
        out geom;
34
    """
35
36
37
def get_ground_floor_tracks() -> str:
38
    return f"""
39
        (
40
            way["railway"="rail"][!"layer"](area.operatingSite);
41
            way["disused:railway"="rail"][!"layer"](area.operatingSite);
42
            way["abandoned:railway"="rail"][!"layer"](area.operatingSite);
43
            
44
            way["railway"="rail"]["layer"="0"](area.operatingSite);
45
            way["disused:railway"="rail"]["layer"="0"](area.operatingSite);
46
            way["abandoned:railway"="rail"]["layer"="0"](area.operatingSite);
47
        );
48
    """
49
50
51
def get_operating_site_separator() -> str:
52
    return f"""
53
        (._;>;);
54
        out;
55
        node(1);
56
        out ids;
57
    """
58