diff --git a/src/data/fleet/f-mts~rt~onebusaway.json b/src/data/fleet/f-mts~rt~onebusaway.json new file mode 100644 index 00000000..983cd93a --- /dev/null +++ b/src/data/fleet/f-mts~rt~onebusaway.json @@ -0,0 +1,339 @@ +[ + { + "type": "Trolley", + "manufacturer": "Siemens", + "model": "LRV", + "regex": "^0[0-9]{2}$", + "image": "https://www.sdmts.com/sites/default/files/attachments/GAS15%20%2828%29.jpg", + "credit": "MTS photo", + "home": "SDTI" + }, + { + "type": "Vintage Trolley", + "manufacturer": "St. Louis Car Company", + "model": "PCC", + "year": 1946, + "regex": "529|530", + "image": "https://www.sdmts.com/sites/default/files/attachments/MTS-VT-AmericaPlaza%5B2%5D.jpg", + "credit": "MTS photo", + "home": "SDTI" + }, + { + "type": "Vintage Trolley", + "manufacturer": "Siemens-Düwag", + "model": "U2", + "year": 1980, + "regex": "^1001$", + "image": "https://www.sdmts.com/sites/default/files/attachments/vintage-streetcar.jpg", + "credit": "MTS photo", + "home": "SDTI" + }, + { + "type": "Over-the-Road Coach", + "manufacturer": "MCI", + "model": "D4500", + "year": 2020, + "regex": "^85[0-9]{2}$", + "home": "ECD" + }, + { + "type": "Standard MTS Bus", + "manufacturer": "New Flyer", + "model": "C40LF", + "year": 2009, + "regex": "^28[0-9]{2}$|^73[0-9]{2}$", + "home": "SBD" + }, + { + "type": "Standard MTS Bus", + "manufacturer": "New Flyer", + "model": "C40LFR", + "year": 2012, + "regex": "^29[0-9]{2}$", + "home": "SBD" + }, + { + "type": "Standard MTS Bus", + "manufacturer": "Gillig", + "model": "Low-Floor", + "year": 2013, + "regex": "^23[0-9]{2}$", + "home": "SBD/ECD" + }, + { + "type": "Minibus", + "manufacturer": "El Dorado Nat'l", + "model": "AeroElite 320", + "year": 2014, + "regex": "^30[0-9]{2}$", + "home": "CPD" + }, + { + "type": "Standard MTS Bus", + "manufacturer": "Gillig", + "model": "Low-Floor", + "year": 2014, + "regex": "^24[0-9]{2}$", + "home": "SBD" + }, + { + "type": "Standard MTS Bus", + "manufacturer": "Gillig", + "model": "Low-Floor", + "year": 2015, + "regex": "^20[0-9]{2}$", + "home": "SBD" + }, + { + "type": "Standard MTS Bus", + "manufacturer": "Gillig", + "model": "Low-Floor", + "year": 2015, + "regex": "^82[0-9]{2}$", + "home": "ECD" + }, + { + "type": "Minibus", + "manufacturer": "El Dorado Nat'l", + "model": "AeroElite 320", + "year": 2016, + "regex": "^31[0-9]{2}$", + "home": "CPD" + }, + { + "type": "Standard MTS Bus", + "manufacturer": "Gillig", + "model": "Low-Floor", + "year": 2016, + "regex": "^83[0-9]{2}$", + "home": "ECD" + }, + { + "type": "Standard MTS Bus", + "manufacturer": "Gillig", + "model": "Low-Floor", + "year": 2017, + "regex": "^21[0-9]{2}$", + "home": "SBD" + }, + { + "type": "Articulated Bus - Urban", + "manufacturer": "New Flyer", + "model": "XN60", + "year": 2017, + "regex": "^74[0-9]{2}$", + "home": "SBD" + }, + { + "type": "Articulated Bus - Rapid Freeway", + "manufacturer": "New Flyer", + "model": "XN60", + "year": 2017, + "regex": "^75[0-9]{2}$", + "home": "SBD" + }, + { + "type": "Articulated Bus - Rapid Freeway", + "manufacturer": "New Flyer", + "model": "XN60", + "year": 2023, + "regex": "^19[0-9]{2}$", + "home": "SBD" + }, + { + "type": "Minibus", + "manufacturer": "Starcraft", + "model": "Allstar XL", + "year": 2018, + "regex": "3506|3507|3508", + "home": "ECD" + }, + { + "type": "Standard MTS Bus", + "manufacturer": "Gillig", + "model": "Low-Floor", + "year": 2018, + "regex": "^278[0-9]$", + "home": "SBD" + }, + { + "type": "Standard MTS Bus", + "manufacturer": "Gillig", + "model": "Low-Floor", + "year": 2022, + "regex": "^22[0-9]{2}$", + "home": "SBD" + }, + { + "type": "Standard MTS Bus", + "manufacturer": "Gillig", + "model": "Low-Floor", + "year": 2019, + "regex": "^835[0-9]$", + "home": "ECD" + }, + { + "type": "Standard MTS Bus", + "manufacturer": "Gillig", + "model": "Low-Floor", + "year": 2020, + "regex": "^279[0-9]$", + "home": "SBD" + }, + { + "type": "ADA Minibus", + "manufacturer": "Starcraft", + "model": "AllStar", + "year": 2014, + "regex": "^390[0-9]$", + "home": "CPD" + }, + { + "type": "ADA Minibus", + "manufacturer": "Starcraft", + "model": "AllStar", + "year": 2015, + "regex": "^397[0-9]$", + "home": "CPD" + }, + { + "type": "ADA Minibus", + "manufacturer": "Starcraft", + "model": "AllStar", + "year": 2016, + "regex": "^33[0-9]{2}$", + "home": "CPD" + }, + { + "type": "ADA Minibus", + "manufacturer": "Starcraft", + "model": "AllStar", + "year": 2017, + "regex": "^32[0-9]{2}$", + "home": "CPD" + }, + { + "type": "ADA Minibus", + "manufacturer": "Starcraft", + "model": "AllStar", + "year": 2018, + "regex": "^363[0-9]$", + "home": "CPD" + }, + { + "type": "Zero Emission Bus", + "manufacturer": "Gillig", + "model": "Low-Floor", + "year": 2020, + "regex": "^16[0-9]{2}$", + "home": "IAD" + }, + { + "type": "Standard MTS Bus", + "manufacturer": "Gillig", + "model": "Low-Floor", + "year": 2020, + "regex": "^17[0-9]{2}$", + "home": "IAD/KMD" + }, + { + "type": "Articulated Bus - Urban", + "manufacturer": "New Flyer", + "model": "XN60", + "year": 2020, + "regex": "^18[0-9]{2}$", + "home": "IAD" + }, + { + "type": "Zero Emission Bus", + "manufacturer": "New Flyer", + "model": "XE40", + "year": 2019, + "regex": "^15[0-9]{2}$", + "image": "https://www.sdmts.com/sites/default/files/attachments/zeb1.jpg", + "home": "ANY" + }, + { + "type": "Standard MTS Bus", + "manufacturer": "Gillig", + "model": "Low-Floor", + "year": 2017, + "regex": "^14[0-9]{2}$", + "home": "IAD" + }, + { + "type": "Standard MTS Bus", + "manufacturer": "Gillig", + "model": "Low-Floor", + "year": 2015, + "regex": "^2[0-9]{2}$", + "home": "KMD" + }, + { + "type": "Articulated Bus - Urban", + "manufacturer": "New Flyer", + "model": "XN60", + "year": 2015, + "regex": "^13[0-9]{2}$", + "home": "KMD" + }, + { + "type": "Standard MTS Bus", + "manufacturer": "Gillig", + "model": "Low-Floor", + "year": 2014, + "regex": "^9[0-9]{2}$", + "image": "https://www.sdmts.com/sites/default/files/attachments/DTW15%20%2839%29.jpg", + "home": "KMD" + }, + { + "type": "Articulated Bus - Rapid", + "manufacturer": "New Flyer", + "model": "XN60", + "year": 2013, + "regex": "^12[0-9]{2}$", + "image": "https://www.sdmts.com/sites/default/files/attachments/DTW15%20%2857%29.jpg", + "home": "IAD" + }, + { + "type": "Articulated Bus - Rapid Freeway", + "manufacturer": "New Flyer", + "model": "XN60", + "year": 2013, + "regex": "^11[0-9]{2}$", + "home": "KMD" + }, + { + "type": "Standard MTS Bus", + "manufacturer": "Gillig", + "model": "Low-Floor", + "year": 2013, + "regex": "^8[0-9]{2}$", + "home": "IAD", + "image": "https://www.sdmts.com/sites/default/files/attachments/DTW15%20%2844%29.jpg" + }, + { + "type": "Standard MTS Bus", + "manufacturer": "New Flyer", + "model": "C40LFR", + "year": 2012, + "regex": "^7[0-9]{2}$", + "home": "IAD" + }, + { + "type": "Standard MTS Bus", + "manufacturer": "New Flyer", + "model": "C40LFR", + "year": 2011, + "regex": "^6[0-9]{2}$", + "home": "IAD" + }, + { + "type": "Standard Rapid Bus", + "manufacturer": "New Flyer", + "model": "C40LF", + "year": 2008, + "regex": "^3[0-9]{2}$", + "home": "KMD" + } +] \ No newline at end of file diff --git a/src/maplibre/+page.svelte b/src/maplibre/+page.svelte deleted file mode 100644 index 6ed9b91b..00000000 --- a/src/maplibre/+page.svelte +++ /dev/null @@ -1,900 +0,0 @@ - - - - -{#if typeof geolocation === "object"} -{#if typeof geolocation.coords.speed === "number"} - - -
- {geolocation.coords.speed.toFixed(2)} m/s {(3.6 * geolocation.coords.speed).toFixed(2)} km/h -
-{/if} - -{/if} - -
- - - diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index c6f6c3e5..3ff07ce5 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -38,6 +38,9 @@ import Alertpopup from '../components/alertpopup.svelte'; import { addShapes } from '../components/addLayers/addShapes'; import Artwork from '../components/artwork.svelte'; + + import mtsFleetData from '../data/fleet/f-mts~rt~onebusaway.json' + let enabledlayerstyle = 'text-black dark:text-white bg-blue-200 dark:bg-gray-700 border border-blue-800 dark:border-blue-200 text-sm md:text-sm'; let disabledlayerstyle = @@ -65,6 +68,8 @@ let geometryObj : Record = {}; let lasttimeofnorth = 0; + let selectedVehicle: any = null; + const urlParams = typeof window !== "undefined" ? new URLSearchParams(window.location.search) : new URLSearchParams(); let debugmode = !!(urlParams.get('debug')); @@ -836,7 +841,8 @@ contrastdarkmode: contrastdarkmode, contrastdarkmodebearing, routeId: routeId, - headsign: headsign + headsign: headsign, + agency: realtime_id, }, geometry: { type: 'Point', @@ -1145,17 +1151,53 @@ current_map_heading = map.getBearing(); } - //on hover - map.on('mousemove', 'busshapes', (events) => { - //console.log('hoverfea', events.features); + map.on('click', 'localrail', (events) => { + sidebarCollapsed = false + if (events.features) { + console.log(events.features[0]) + selectedVehicle = events.features[0] + sidebarView = 9999 + } + }); + + map.on('click', 'intercityrail', (events) => { + sidebarCollapsed = false + if (events.features) { + selectedVehicle = events.features[0] + sidebarView = 9999 + } + }); + + map.on('click', 'bus', (events) => { + sidebarCollapsed = false + if (events.features) { + selectedVehicle = events.features[0] + sidebarView = 9999 + } + }); + + map.on('mouseenter', 'localrail', () => { + map.getCanvas().style.cursor = 'pointer'; + }); + + map.on('mouseleave', 'localrail', () => { + map.getCanvas().style.cursor = ''; }); - map.on('mousemove', 'railshapes', (events) => { - // console.log('hoverfea-rail', events.features); + map.on('mouseenter', 'intercityrail', () => { + map.getCanvas().style.cursor = 'pointer'; + }); + + map.on('mouseleave', 'intercityrail', () => { + map.getCanvas().style.cursor = ''; }); - map.on('mousemove', 'buses', (events) => { - //console.log('hover over realtime bus', events.features) + map.on('mouseenter', 'bus', () => { + map.getCanvas().style.cursor = 'pointer'; + }); + + map.on('mouseleave', 'bus', () => { + map.getCanvas().style.cursor = ''; }); map.on('moveend', (events) => { @@ -2315,12 +2357,91 @@ on:keydown={() => { {/if} {/if} {#if sidebarView == 9999} -

{strings.art}

+ {#if selectedVehicle.properties.agency == 'f-mts~rt~onebusaway'} + {#if selectedVehicle.properties.maptag == 'Green'} + + {:else if selectedVehicle.properties.maptag == 'Orange'} + + {:else if selectedVehicle.properties.maptag == 'Blue'} + + {/if} + {/if} + {#if selectedVehicle.properties.agency == 'f-northcountrytransitdistrict~rt'} + {#if selectedVehicle.properties.maptag == 'COASTER'} + + {:else if selectedVehicle.properties.maptag == 'SPRINTER'} + + {:else if selectedVehicle.properties.maptag == '350'} + + {/if} + {/if} + {#if selectedVehicle.properties.agency == 'f-metro~losangeles~rail~rt'} + {#if selectedVehicle.properties.maptag == 'A'} + + {:else if selectedVehicle.properties.maptag == 'B'} + + {:else if selectedVehicle.properties.maptag == 'C'} + + {:else if selectedVehicle.properties.maptag == 'D'} + + {:else if selectedVehicle.properties.maptag == 'E'} + + {:else if selectedVehicle.properties.maptag == 'K'} + + {/if} + {/if} + {#if selectedVehicle.properties.agency == 'f-metrolinktrains~rt'} + + {/if} + {#if selectedVehicle.properties.agency == 'f-octa~rt'} + +
+ {/if} + {#if selectedVehicle.properties.agency == 'f-amtrak~rt'} + +
+ {/if} + {#if (selectedVehicle.properties.agency != 'f-metro~losangeles~rail~rt')} +

{selectedVehicle.properties.maptag}

+ {/if} +
+ {#if selectedVehicle.properties.vehicleIdLabel} + Vehicle ID {selectedVehicle.properties.vehicleIdLabel} +
+ {/if} + {#if selectedVehicle.properties.tripIdLabel} + Trip ID {selectedVehicle.properties.tripIdLabel} +
+ {/if} + {#if selectedVehicle.properties.speed !== 0} + Speed {selectedVehicle.properties.speed.toFixed(3)} +
+ {/if} + {#if selectedVehicle.properties.bearing !== 0} + Bearing {selectedVehicle.properties.bearing.toFixed(3)} +
+ {/if} + {#if selectedVehicle.properties.agency == 'f-mts~rt~onebusaway'} + {#each mtsFleetData as { type, manufacturer, model, year, regex, home, image }} + {#if (new RegExp(regex)).test(selectedVehicle.properties.vehicleIdLabel || '')} + Type {type} +
+ Vehicle {year || ''} {manufacturer} {model} +
+ Home {home} +

+ {#if image} + {model} + {/if} + {/if} + {/each} + {/if} + {/if} +