aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/README.md46
-rw-r--r--data/download-stops.py19
-rw-r--r--data/overrides/fix-gregorio-espino.yaml20
-rw-r--r--data/overrides/hide-virtual-stops.yaml17
-rw-r--r--data/overrides/improve-coordinates-misc.yaml35
-rw-r--r--data/stop-overrides.yaml45
-rw-r--r--public/stops.json50
7 files changed, 149 insertions, 83 deletions
diff --git a/data/README.md b/data/README.md
new file mode 100644
index 0000000..dd1da79
--- /dev/null
+++ b/data/README.md
@@ -0,0 +1,46 @@
+# Bus Stop Overrides
+
+This file defines custom overrides for specific bus stops in YAML format.
+
+## Format
+
+```yaml
+stopId: # Numeric ID of the stop to override
+ name: # Override the name (string)
+ alternateNames: # Additional names for the stop (map)
+ key: # e.g. name used in metro maps
+ location: # Override location coordinates (map)
+ latitude: # New latitude value (float)
+ longitude: # New longitude value (float)
+ hide: # Hide the stop from the map and list (boolean)
+ amenities: # List of amenities available at this stop (list)
+ - shelter
+ - real-time display
+```
+
+## Field Descriptions
+
+- **stopId** (integer): Unique identifier of the bus stop.
+- **alternateNames** (object): Other names used in different contexts.
+ - **key** (string): Name used in a specific context, such as `metro`.
+- **location** (object):
+ - **latitude** (float): Override latitude coordinate.
+ - **longitude** (float): Override longitude coordinate.
+- **hide** (boolean): Set to `true` to exclude the stop from maps and listings.
+- **amenities** (array of strings): Amenities available at this stop, such as `shelter` or `real-time display`. For now, only those two will be supported in the app.
+
+## Example
+
+```yaml
+12345:
+ name: "Central Station"
+ alternateNames:
+ metro: "Main Hub"
+ location:
+ latitude: 40.712776
+ longitude: -74.005974
+ hide: false
+ amenities:
+ - shelter
+ - real-time display
+``` \ No newline at end of file
diff --git a/data/download-stops.py b/data/download-stops.py
index 957e50d..54c57ed 100644
--- a/data/download-stops.py
+++ b/data/download-stops.py
@@ -26,11 +26,7 @@ def apply_overrides(stops, overrides):
stop_id = stop.get("stopId")
if stop_id in overrides:
override = overrides[stop_id]
-
- # Apply name override
- if "name" in override:
- stop["name"] = override["name"]
-
+
# Apply or add alternate names
if "alternateNames" in override:
for key, value in override["alternateNames"].items():
@@ -84,9 +80,16 @@ def main():
# Load and apply overrides
script_dir = os.path.dirname(os.path.abspath(__file__))
- overrides_file = os.path.join(script_dir, "stop-overrides.yaml")
- overrides = load_stop_overrides(overrides_file)
- processed_stops = apply_overrides(processed_stops, overrides)
+ overrides_dir = os.path.join(script_dir, "overrides")
+ # For each YML/YAML file in the overrides directory, load and apply the overrides
+ for filename in os.listdir(overrides_dir):
+ if not filename.endswith(".yml") and not filename.endswith(".yaml"):
+ continue
+
+ print(f"Loading overrides from {filename}")
+ overrides_file = os.path.join(overrides_dir, filename)
+ overrides = load_stop_overrides(overrides_file)
+ processed_stops = apply_overrides(processed_stops, overrides)
# Filter out hidden stops
visible_stops = [stop for stop in processed_stops if not stop.get("hide")]
diff --git a/data/overrides/fix-gregorio-espino.yaml b/data/overrides/fix-gregorio-espino.yaml
new file mode 100644
index 0000000..2e035a2
--- /dev/null
+++ b/data/overrides/fix-gregorio-espino.yaml
@@ -0,0 +1,20 @@
+# Fix the position of the stops in Gregorio Espino, which are "opposite" to the actual location of the bus stops.
+5720: # Gregorio Espino, 33
+ location:
+ latitude: 42.23004933454558
+ longitude: -8.706947409683313
+
+5710: # Gregorio Espino, 22
+ location:
+ latitude: 42.23003666347398
+ longitude: -8.707266671978003
+
+5730: # Gregorio Espino, 44
+ location:
+ latitude: 42.227850036119314
+ longitude: -8.708105429626789
+
+5740: # Gregorio Espino, 57
+ location:
+ latitude: 42.22783722597372
+ longitude: -8.707849091551859 \ No newline at end of file
diff --git a/data/overrides/hide-virtual-stops.yaml b/data/overrides/hide-virtual-stops.yaml
new file mode 100644
index 0000000..a2bf0b1
--- /dev/null
+++ b/data/overrides/hide-virtual-stops.yaml
@@ -0,0 +1,17 @@
+# The Vitrasa network has several virtual stops created for internal purposes, like
+# end of certain lines with a "nice" name.
+
+20223: # Castrelos (Pavillón) - Final U1
+ hide: true
+20146: # García Barbón 7 - final líneas A y 18A
+ hide: true
+20220: # (Samil) COIA-SAMIL - Final L15A
+ hide: true
+20001: # (Samil) Samil por Beiramar - Final L15B
+ hide: true
+20002: # (Samil) Samil por Torrecedeira - Final L15C
+ hide: true
+20144: # (Samil) Samil por Coia - Final C3D+C3i
+ hide: true
+20145: # (Samil) Samil por Bouzas - Final C3D+C3i
+ hide: true \ No newline at end of file
diff --git a/data/overrides/improve-coordinates-misc.yaml b/data/overrides/improve-coordinates-misc.yaml
new file mode 100644
index 0000000..5779565
--- /dev/null
+++ b/data/overrides/improve-coordinates-misc.yaml
@@ -0,0 +1,35 @@
+# Improves coordinates for some locations in the dataset to be more accurate, and avoid clustering
+6620: # Policarpo Sanz, 40
+ location:
+ latitude: 42.23757846151978
+ longitude: -8.721031378896738
+
+20193: # Policarpo Sanz, 25
+ location:
+ latitude: 42.23767601188501
+ longitude: -8.721582630122455
+
+3130: #Avda. de Cesáreo Vázquez 169
+ location:
+ latitude: 42.1909867388476
+ longitude: -8.799722173771636
+
+3090: # Avda. de Cesáreo Vázquez 182
+ location:
+ latitude: 42.19102742639083
+ longitude: -8.799428820699774
+
+14294: # Avda. de Ricardo Mella 406
+ location:
+ latitude: 42.190684424876565
+ longitude: -8.799308812770041
+
+3120: # Cesáreo Vázquez 141
+ location:
+ latitude: 42.187377693269696
+ longitude: -8.800971611890894
+
+3080: # Cesáreo Vázquez 136
+ location:
+ latitude: 42.18722607751238
+ longitude: -8.800947897477887
diff --git a/data/stop-overrides.yaml b/data/stop-overrides.yaml
index f20f633..1a5674c 100644
--- a/data/stop-overrides.yaml
+++ b/data/stop-overrides.yaml
@@ -27,49 +27,4 @@
# - shelter
# - real-time display
-6620: # Policarpo Sanz, 40
- location:
- latitude: 42.23757846151978
- longitude: -8.721031378896738
-20193: # Policarpo Sanz, 25
- location:
- latitude: 42.23767601188501
- longitude: -8.721582630122455
-
-5720: # Gregorio Espino, 33
- location:
- latitude: 42.23004933454558
- longitude: -8.706947409683313
-
-5710: # Gregorio Espino, 22
- location:
- latitude: 42.23003666347398
- longitude: -8.707266671978003
-
-5730: # Gregorio Espino, 44
- location:
- latitude: 42.227850036119314
- longitude: -8.708105429626789
-
-5740: # Gregorio Espino, 57
- location:
- latitude: 42.22783722597372
- longitude: -8.707849091551859
-
-#region Hidden stops
-20223: # Castrelos (Pavillón) - Final U1
- hide: true
-20146: # García Barbón 7 - final líneas A y 18A
- hide: true
-20220: # (Samil) COIA-SAMIL - Final L15A
- hide: true
-20001: # (Samil) Samil por Beiramar - Final L15B
- hide: true
-20002: # (Samil) Samil por Torrecedeira - Final L15C
- hide: true
-20144: # (Samil) Samil por Coia - Final C3D+C3i
- hide: true
-20145: # (Samil) Samil por Bouzas - Final C3D+C3i
- hide: true
-#endregion \ No newline at end of file
diff --git a/public/stops.json b/public/stops.json
index b5420df..883581c 100644
--- a/public/stops.json
+++ b/public/stops.json
@@ -2,18 +2,13 @@
{
"stopId": 6930,
"name": {
- "original": "Praza de América 1",
- "intersect": "Praza América - Camelias"
+ "original": "Praza de América 1"
},
"latitude": 42.220997313,
"longitude": -8.732835177,
"lines": [
"C1",
"N4"
- ],
- "amenities": [
- "shelter",
- "real-time display"
]
},
{
@@ -276,8 +271,7 @@
{
"stopId": 14264,
"name": {
- "original": "Rúa de Urzáiz - Príncipe",
- "intersect": "Urzáiz - Príncipe"
+ "original": "Rúa de Urzáiz - Príncipe"
},
"latitude": 42.235873545,
"longitude": -8.720083317,
@@ -302,10 +296,6 @@
"28",
"N1",
"N4"
- ],
- "amenities": [
- "shelter",
- "real-time display"
]
},
{
@@ -3708,8 +3698,8 @@
"name": {
"original": "Avda. do Alcalde Gregorio Espino 57"
},
- "latitude": 42.227831786,
- "longitude": -8.707855407,
+ "latitude": 42.22783722597372,
+ "longitude": -8.707849091551859,
"lines": [
"4C",
"23",
@@ -3724,8 +3714,8 @@
"name": {
"original": "Avda. do Alcalde Gregorio Espino 33"
},
- "latitude": 42.230134504,
- "longitude": -8.706992656,
+ "latitude": 42.23004933454558,
+ "longitude": -8.706947409683313,
"lines": [
"4C",
"23",
@@ -6031,8 +6021,8 @@
"name": {
"original": "Avda. do Alcalde Gregorio Espino 44"
},
- "latitude": 42.227970137,
- "longitude": -8.708024217,
+ "latitude": 42.227850036119314,
+ "longitude": -8.708105429626789,
"lines": [
"31",
"H2"
@@ -8419,8 +8409,8 @@
"name": {
"original": "Avda. de Cesáreo Vázquez 136"
},
- "latitude": 42.187532955,
- "longitude": -8.800948579,
+ "latitude": 42.18722607751238,
+ "longitude": -8.800947897477887,
"lines": [
"11"
]
@@ -8430,8 +8420,8 @@
"name": {
"original": "Avda. de Cesáreo Vázquez 182"
},
- "latitude": 42.190974769,
- "longitude": -8.79947071,
+ "latitude": 42.19102742639083,
+ "longitude": -8.799428820699774,
"lines": [
"C3d",
"10",
@@ -9100,8 +9090,8 @@
"name": {
"original": "Avda. de Cesáreo Vázquez 169"
},
- "latitude": 42.191030413,
- "longitude": -8.799596773,
+ "latitude": 42.1909867388476,
+ "longitude": -8.799722173771636,
"lines": [
"11"
]
@@ -9111,8 +9101,8 @@
"name": {
"original": "Avda. de Cesáreo Vázquez 141"
},
- "latitude": 42.187320701,
- "longitude": -8.801121407,
+ "latitude": 42.187377693269696,
+ "longitude": -8.800971611890894,
"lines": [
"11",
"12A"
@@ -11483,8 +11473,8 @@
"name": {
"original": "Avda. do Alcalde Gregorio Espino 22"
},
- "latitude": 42.230108908,
- "longitude": -8.707230032,
+ "latitude": 42.23003666347398,
+ "longitude": -8.707266671978003,
"lines": [
"31"
]
@@ -13231,8 +13221,8 @@
"name": {
"original": "Avda. de Ricardo Mella 406"
},
- "latitude": 42.190704974,
- "longitude": -8.799306832,
+ "latitude": 42.190684424876565,
+ "longitude": -8.799308812770041,
"lines": [
"12A"
]