Compare commits

..
13 Commits
Author SHA1 Message Date
legonzaur 5cdfbd3bb5 wip: working on trips 2026-07-18 12:01:53 +02:00
legonzaur 6dbefb0e33 feat: style walk dasharray 2026-07-13 18:28:58 +02:00
legonzaur 69ec5436f8 feat: plan trip 2026-07-13 18:22:58 +02:00
legonzaur 9a97bf6088 wip: trip planner 2026-07-12 22:18:17 +02:00
legonzaur 235cdacf9e cluster selection 2026-07-12 11:19:16 +02:00
legonzaur 9f1104b34f add smooth zoom when not selecting a route 2026-07-12 10:12:34 +02:00
Nathan Tien You 0ec0f681b2 fix: prevent fetching clusters when no route is selected 2026-07-08 08:54:04 +02:00
Nathan Tien You d8e9db3c59 feat: add icon instead of red circle 2026-07-08 08:40:52 +02:00
legonzaur efbac6cef7 wip 2026-07-07 21:06:04 +02:00
legonzaur 34c12135ca wip: POC arrival times 2026-07-06 23:27:32 +02:00
legonzaur 23c1186689 attemp at handling data not ready in state 2026-07-06 20:47:52 +02:00
legonzaur 9324a08cf9 Use pinia 2026-07-06 19:49:28 +02:00
legonzaur d345ea9ec3 wip: use pinia 2026-07-05 16:25:54 +02:00
21 changed files with 892 additions and 167 deletions
+1
View File
@@ -0,0 +1 @@
GTFS : le C6 c'est pas présent
+5 -3
View File
@@ -1,13 +1,15 @@
<template>
<div id="main">
<NuxtLayout>
<NuxtRouteAnnouncer />
<NuxtPage />
</div>
</NuxtLayout>
</template>
<style lang="css">
body,
#main {
#main,
#__nuxt,
main {
height: 100vh;
margin: 0;
}
+114 -23
View File
@@ -1,10 +1,6 @@
<template>
<ClientOnly>
<mgl-geo-json-source
v-if="clusters"
source-id="clusters"
:data="clusters"
>
<mgl-geo-json-source source-id="clusters" :data="clusters">
<mgl-circle-layer
layer-id="clusters_dots"
:paint="cluster_paint"
@@ -12,11 +8,37 @@
@mouseenter="clusterEnter"
@mouseleave="clusterLeave"
/>
<MglSymbolLayer
layer-id="cluster_icon"
:layout="{
'icon-image': 'cluster',
'icon-size': 0.1,
'icon-overlap': 'always',
'text-overlap': 'always',
}"
@mouseenter="clusterEnter"
@mouseleave="clusterLeave"
/>
<MglSymbolLayer
layer-id="clusters_labels"
:layout="cluster_label"
/>
</mgl-geo-json-source>
<div ref="popup-div">
<div v-for="data in popupData" :key="data.pattern.id">
Direction {{ data.pattern.lastStopName }}
<div v-for="time in data.times" :key="time.tripId">
{{
stopTimeToRealTime(
time.realtimeArrival,
time.serviceDay,
)
}}
</div>
</div>
</div>
</ClientOnly>
</template>
@@ -24,20 +46,45 @@
import type { FeatureCollection, Point } from "geojson";
import { useMap } from "@indoorequal/vue-maplibre-gl";
import { Popup } from "maplibre-gl";
const cluster_paint = {
"circle-radius": 5,
"circle-color": "#FF0000",
};
const cluster_label = {
"text-field": ["get", "id"],
};
const map = useMap();
const { clusters } = defineProps<{
const cluster_label = {
"text-field": ["get", "name"],
};
const map = useMap("main");
const popupDiv = useTemplateRef("popup-div");
const { clusters, route } = defineProps<{
clusters: FeatureCollection<Point>;
route: Route;
}>();
const cluster_paint = {
"circle-radius": 18,
"circle-color": "#" + route.color,
};
const popupData = ref<StopTimesPattern[]>([]);
const popup = new Popup().setMaxWidth("500px").addTo(map.map!);
const router = useRoute();
const store = useMresoStore();
onUnmounted(() => {
popup.off("close", closePopupEventHandler);
popup.remove();
});
watch(
() => router.params.cluster_id,
async () => {
popup.off("close", closePopupEventHandler);
await routerParamChange();
popup.on("close", closePopupEventHandler);
},
{ immediate: true },
);
async function clusterClick(e: FeatureCollection) {
popup.off("close", closePopupEventHandler);
const feature = e.features[0];
if (!feature || !feature.properties) {
return;
@@ -46,17 +93,61 @@ async function clusterClick(e: FeatureCollection) {
if (!code) {
return;
}
const coordinates = feature.geometry.coordinates.slice();
const data = await $fetch<FeatureCollection<Point>>(
`https://data.mobilites-m.fr/api/clusters/${code}/stops`,
);
if (!map.map) {
console.log(code);
navigateTo(`/lines/${router.params.line_id}/cluster/${code}`);
popup.remove();
popup.on("close", closePopupEventHandler);
}
async function routerParamChange() {
if (router.params.cluster_id === undefined) {
popup.remove();
return;
}
new Popup()
.setLngLat(coordinates)
.setHTML(`This cluster contains ${data.features.length} stops`)
.addTo(map.map);
if (typeof router.params.cluster_id !== "string") {
return;
}
const cluster = store.clustersByCode[router.params.cluster_id];
if (!cluster) {
return;
}
const code = cluster.properties?.code;
if (!code) {
return;
}
popupData.value = [];
const coordinates = cluster.geometry.coordinates.slice();
popupData.value = await $fetch<StopTimesPattern[]>(
`https://data.mobilites-m.fr/api/routers/default/index/clusters/${code}/stoptimes?showCancelledTrips=false&route=${route.id}`,
{
headers: {
origin: "PersonalProjectMreso",
},
},
);
if (!popupDiv.value) {
return;
}
popup.setDOMContent(popupDiv.value).setLngLat(coordinates).addTo(map.map!);
}
function closePopupEventHandler() {
navigateTo(`/lines/${router.params.line_id}`);
}
function stopTimeToRealTime(realtimeArrival: number, serviceDay: number) {
const seconds =
realtimeArrival -
(Math.floor(new Date().getTime() / 1000) - serviceDay);
if (seconds < 0) {
return "00:00:00";
}
const date = new Date(0);
date.setSeconds(seconds); // specify value for SECONDS here
const timeString = date.toISOString().substring(11, 19);
return timeString;
}
function clusterEnter() {
+6 -6
View File
@@ -1,8 +1,8 @@
<template>
<mgl-geo-json-source source-id="lines" :data="routeWithLine.line">
<mgl-geo-json-source source-id="lines" :data="line">
<mgl-line-layer layer-id="line" :paint="paint" :layout="layout" />
</mgl-geo-json-source>
<mgl-geo-json-source source-id="lines_border" :data="routeWithLine.line">
<mgl-geo-json-source source-id="lines_border" :data="line">
<mgl-line-layer
layer-id="line_border"
:paint="offset_paint"
@@ -12,14 +12,14 @@
</template>
<script setup lang="ts">
import type { Feature, MultiLineString } from "geojson";
import type { Feature, LineString, MultiLineString } from "geojson";
const { routeWithLine } = defineProps<{
routeWithLine: { route: Route; line: Feature<MultiLineString> };
const { line } = defineProps<{
line: Feature<MultiLineString | LineString, LineProperties>;
}>();
const paint = computed(() => ({
"line-color": "#" + routeWithLine.route.color,
"line-color": "#" + line.properties?.route?.color,
"line-width": 4,
}));
+80 -122
View File
@@ -1,133 +1,98 @@
<template>
<ClientOnly>
<MglMap :map-style="style" :center="center" :zoom="zoom" height="100%">
<MglMap :map-style="style" :center="center" :zoom="zoom" map-key="main">
<MglNavigationControl />
<MapLines
v-for="r of routeWithLines"
:key="r.route.id"
:route-with-line="r"
/>
<MapClusters
v-if="clustersData.features"
:clusters="clustersData"
/>
<MglImage id="cluster" :image="image" />
<template v-for="r of store.selectedLines">
<MapLines :line="r" />
<MapClusters
v-if="shownClusters && r.properties?.route"
:clusters="shownClusters"
:route="r.properties.route"
/></template>
<mgl-geo-json-source
:source-id="`trip_leg_${index}`"
:data="line"
v-for="(line, index) in store.selectedLines"
>
<mgl-line-layer
:layer-id="`trip_line_leg_${index}`"
:paint="{
'line-width': 4,
'line-color':
'#' + (line.properties?.route?.color || '000000'),
'line-dasharray': [
2,
line.properties?.mode == 'WALK' ? 1 : 0,
],
}"
/>
</mgl-geo-json-source>
</MglMap>
</ClientOnly>
<div v-if="routesRequest.data.value" id="lineSelector">
<div
v-for="route of routesRequest.data.value"
:key="route.id"
:class="{
selected: selectedRoutes.includes(route.id),
lineLabel: true,
}"
:style="{
background: '#' + route.color,
color: '#' + route.textColor,
}"
@click="selectRoute(route.id)"
>
{{ route.type }} : {{ route.shortName }}
</div>
</div>
</template>
<script setup lang="ts">
import type {
Feature,
FeatureCollection,
MultiLineString,
Point,
} from "geojson";
import type { FeatureCollection, Point } from "geojson";
import { useMap } from "@indoorequal/vue-maplibre-gl";
import { LngLat, LngLatBounds } from "maplibre-gl";
const style = "https://tiles.versatiles.org/assets/styles/colorful/style.json";
// const style =
// "https://data.geopf.fr/annexes/ressources/vectorTiles/styles/PLAN.IGN/standard.json";
const center = new LngLat(5.735, 45.185);
const zoom = 12;
const map = useMap();
const emit = defineEmits<{
loaded: [];
}>();
const selectedRoutes = ref<string[]>([]);
const selectedStops = ref<string[]>([]);
const store = useMresoStore();
await store.fetchData();
const shownClusters = ref<FeatureCollection<Point> | null>(null);
const image = useSvgImage();
const map = useMap("main");
const clustersRequest =
await useFetch<FeatureCollection<Point>>("/clusters.json");
const clusters = computed(() => clustersRequest.data.value?.features ?? []);
const clustersData = computed<FeatureCollection<Point>>(() => {
return {
watch(map, () => {
if (map.isLoaded) {
emit("loaded");
}
});
watchEffect(async () => {
const allClusters = [];
for (const line of store.selectedLines) {
if (line.properties.route === undefined) {
continue;
}
const apiClusters = await $fetch<Cluster[]>(
`https://data.mobilites-m.fr/api/routers/default/index/routes/${line.properties.route.id}/clusters`,
);
allClusters.push(...apiClusters);
}
shownClusters.value = {
type: "FeatureCollection",
features: clusters.value.filter((f) =>
selectedStops.value.includes(f.properties?.id),
),
features: allClusters
.map((c) => store.clustersByCode[c.code])
.filter((c) => c !== undefined),
};
});
const linesRequest =
await useFetch<FeatureCollection<MultiLineString>>("/lignes.json");
const transport_lines = computed(() => linesRequest.data.value?.features ?? []);
const routesRequest = await useFetch<Route[]>("/routes.json");
// Selected routes with lines
const routeWithLines = computed(() => {
const shownLines: { route: Route; line: Feature<MultiLineString> }[] = [];
for (const routeId of selectedRoutes.value) {
const route = routesRequest.data.value?.find((r) => r.id == routeId);
if (!route) {
continue;
}
const line = transport_lines.value.find(
(f) => routeId == f.properties?.id.replace("_", ":"),
);
if (!line) {
continue;
}
shownLines.push({
route,
line,
});
}
return shownLines;
});
async function selectRoute(routeId: string) {
if (!map.map) {
console.error("Map is not yet initialized ! aborting");
return;
}
selectedRoutes.value = [routeId];
const stops: string[] = [];
for (const route of selectedRoutes.value) {
const data = await $fetch<Cluster[]>(
`https://data.mobilites-m.fr/api/routers/default/index/routes/${route.replace("_", ":")}/clusters`,
);
for (const stop of data) {
stops.push(stop.id);
}
}
selectedStops.value = stops;
const points = clusters.value.filter((c) =>
stops.includes(c.properties?.id),
);
const firstPoint = points[0];
const firstPoint = shownClusters.value.features[0];
if (!firstPoint) {
console.error("Data does not contains any points. Aborting");
map.map?.flyTo({ center, zoom });
return;
}
const bounds = clusters.value
.filter((c) => stops.includes(c.properties?.id))
const coordinates = [
...shownClusters.value.features.map(
(point) => point.geometry.coordinates,
),
...store.selectedLines.map((line) => line.geometry.coordinates).flat(2),
];
const bounds = coordinates
// .filter((c) => stops.includes(c.properties?.id))
.reduce(
(bounds, point) => {
return bounds.extend(
new LngLat(
point.geometry.coordinates[0]!,
point.geometry.coordinates[1]!,
),
);
(bounds, coords) => {
return bounds.extend(new LngLat(coords[0], coords[1]));
},
new LngLatBounds([
firstPoint.geometry.coordinates[0]!,
@@ -136,27 +101,20 @@ async function selectRoute(routeId: string) {
firstPoint.geometry.coordinates[1]!,
]),
);
map.map.fitBounds(bounds, {
map.map!.fitBounds(bounds, {
padding: 20,
});
}
});
</script>
<style scoped lang="css">
#lineSelector {
position: fixed;
left: 0;
top: 0;
height: 100vh;
overflow: auto;
background: white;
.maplibregl-map {
grid-area: "map";
}
</style>
.lineLabel {
cursor: pointer;
}
.lineLabel.selected {
color: red !important;
<style lang="css">
.maplibregl-map {
grid-area: map;
}
</style>
+43
View File
@@ -0,0 +1,43 @@
<template>
<div id="sidebar">
<div
v-for="route of store.routes"
:key="route.id"
:class="{
selected: store.selectedLines.find(
(l) => l.properties?.route?.id == route.id,
),
lineLabel: true,
}"
:style="{
background: '#' + route.color,
color: '#' + route.textColor,
}"
@click="selectRoute(route.id)"
>
{{ route.type }} : {{ route.shortName }}
</div>
</div>
</template>
<script setup lang="ts">
const store = useMresoStore();
function selectRoute(routeId: string) {
navigateTo(`/lines/${routeId}`);
}
</script>
<style scoped lang="css">
.lineLabel {
cursor: pointer;
}
.lineLabel.selected {
color: red !important;
}
#sidebar {
hewight: 100%;
overflow: auto;
grid-area: sidebar;
}
</style>
+17
View File
@@ -0,0 +1,17 @@
<template>
<div id="sidebar">
<input type="text" placeholder="from" value="SEM:GENBIBLIUNI" />
<input type="text" placeholder="to" value="SEM:GENPERE" />
<button @click="$emit('plan')">request</button>
</div>
</template>
<script setup lang="ts"></script>
<style scoped>
#sidebar {
height: 100%;
overflow: auto;
grid-area: sidebar;
}
</style>
+16
View File
@@ -0,0 +1,16 @@
const clustersRequest = $fetch<Blob>(
"https://pass.mobilites-m.fr/assets/icons/clusters.svg",
);
const image = new Image();
const imageLoadPromise = new Promise((resolve) => {
image.onload = resolve;
});
clustersRequest.then((blob) => {
image.src = URL.createObjectURL(blob);
});
await Promise.all([imageLoadPromise, clustersRequest]); // Wait for the image to load
export const useSvgImage = () => {
return useState("cluster.svg", () => image);
};
+51
View File
@@ -0,0 +1,51 @@
<template>
<main>
<div id="map-container">
<Map map-key="main" @loaded="loaded" />
<Transition>
<div id="map-loading" v-if="!mapReady">Loading</div>
</Transition>
</div>
<slot />
</main>
</template>
<style scoped lang="css">
main {
display: grid;
grid-template-columns: 400px 1fr;
grid-template-areas: "sidebar map";
height: 100%;
}
#map-container {
position: relative;
height: 100%;
}
#map-loading {
height: 100%;
width: 100%;
position: absolute;
top: 0;
background: white;
display: flex;
align-items: center;
justify-content: center;
}
.v-enter-active,
.v-leave-active {
transition: opacity 0.5s ease;
}
.v-enter-from,
.v-leave-to {
opacity: 0;
}
</style>
<script setup lang="ts">
const mapReady = ref(false);
function loaded() {
mapReady.value = true;
}
</script>
+43
View File
@@ -0,0 +1,43 @@
<template>
<SidebarLines />
</template>
<script lang="ts">
definePageMeta({ key: "lines" });
</script>
<script setup lang="ts">
const router = useRoute();
const store = useMresoStore();
watch(
[
() => router.params.line_id,
() => store.linesById,
() => store.routesById,
],
() => {
const lineId = router.params.line_id;
console.log(lineId);
if (lineId === undefined) {
store.selectedLines = [];
return;
}
if (typeof lineId !== "string") {
store.selectedLines = [];
return;
}
const lineClone = structuredClone(
toRaw(store.linesById[lineId.replace(":", "_")]),
);
if (!lineClone) {
console.log(store.linesById, lineId.replace(":", "_"));
return;
}
lineClone.properties = { route: store.routesById[lineId] };
store.selectedLines = [lineClone];
console.log(store.selectedLines);
},
{ immediate: true },
);
</script>
-3
View File
@@ -1,3 +0,0 @@
<template>
<Map />
</template>
+57
View File
@@ -0,0 +1,57 @@
<template>
<SidebarTrip @plan="plan" />
</template>
<script setup lang="ts">
import { LngLat } from "maplibre-gl";
import { decode } from "@googlemaps/polyline-codec";
import type { Feature, LineString } from "geojson";
definePageMeta({ key: "trip" });
const from = "SEM:GENBIBLIUNI";
const to = "SEM:GENALSACELO";
const store = useMresoStore();
function plan() {
const fromCoord = store.clustersByCode[from]?.geometry.coordinates;
const toCoord = store.clustersByCode[to]?.geometry.coordinates;
if (!fromCoord || !toCoord) {
return;
}
const planner = new TransitRoutePlanner(
new LngLat(fromCoord[1]!, fromCoord[0]!),
new LngLat(toCoord[1]!, toCoord[0]!),
);
planner.request().then((data) => {
const GeoLines: Feature<LineString, LineProperties>[] = [];
const itinerary = data.plan.itineraries[0];
if (!itinerary) {
console.log("No Itineraries found");
return;
}
for (const leg of itinerary.legs) {
console.log(leg);
const points = leg.legGeometry.points;
if (!points) {
return;
}
const lines = decode(points).map(([lat, lng]) => [lng, lat]);
const lineString: Feature<LineString, LineProperties> = {
type: "Feature",
properties: {
mode: leg.mode,
},
geometry: {
type: "LineString",
coordinates: lines,
},
};
if (leg.routeId) {
lineString.properties!.route = store.routesById[leg.routeId];
}
GeoLines.push(lineString);
}
store.selectedLines = GeoLines;
});
}
</script>
+55
View File
@@ -0,0 +1,55 @@
import type {
Feature,
FeatureCollection,
LineString,
MultiLineString,
Point,
} from "geojson";
export const useMresoStore = defineStore("mresoStore", {
state: () => ({
routes: [] as Route[],
lines: {} as FeatureCollection<MultiLineString>,
clusters: {} as FeatureCollection<Point>,
stops: {} as FeatureCollection<Point>,
selectedLines: [] as Feature<
LineString | MultiLineString,
LineProperties
>[],
}),
actions: {
async fetchData(options: { signal?: AbortSignal } = {}) {
[this.routes, this.lines, this.clusters, this.stops] = await Promise.all([
$fetch<Route[]>("/routes.json", options),
$fetch<FeatureCollection<MultiLineString>>("/lines.json", options),
// $fetch<FeatureCollection<MultiLineString>>(
// "/trajets presque clean.geojson",
// options,
// ),
$fetch<FeatureCollection<Point>>("/clusters.json", options),
$fetch<FeatureCollection<Point>>("/stops.json", options),
]);
},
},
getters: {
routesById(state): { [id: string]: Route } {
return Object.fromEntries(state.routes.map((r) => [r.id, r]));
},
linesById(state): { [id: string]: Feature<MultiLineString> } {
if (!("features" in state.lines)) {
return {};
}
return Object.fromEntries(
state.lines.features.map((l) => [l.properties!.id, l]),
);
},
clustersByCode(state): { [id: string]: Feature<Point> } {
if (!("features" in state.clusters)) {
return {};
}
return Object.fromEntries(
state.clusters.features.map((l) => [l.properties!.code, l]),
);
},
},
});
+141 -1
View File
@@ -7,11 +7,18 @@ interface Route {
textColor: string;
mode: string;
type: string;
timeSheet: string;
timeSheet: boolean;
pdfTimeSheet: boolean;
pdfMap: boolean;
}
interface _LineProperties extends GeoJsonProperties {
route?: Route;
mode?: PlannerModes;
}
type LineProperties = _LineProperties | null;
interface Cluster {
city: string;
code: string;
@@ -21,3 +28,136 @@ interface Cluster {
name: string;
visible: boolean;
}
interface StopTimesPattern {
pattern: {
id: string;
desc: string;
dir: number;
shortDesc: string;
lastStop: string;
lastStopName: string;
};
times: StopTimes[];
}
interface StopTimes {
stopId: string;
stopName: string;
scheduledArrival: number;
scheduledDeparture: number;
realtimeArrival: number;
realtimeDeparture: number;
arrivalDelay: number;
departureDelay: number;
timepoint: boolean;
realtime: boolean;
realtimeState: string;
serviceDay: number;
tripId: string;
pickupType: string;
occupancy: string;
occupancyId: number;
}
interface PlannerResource extends Record<string, string> {
routerId: string;
fromPlace: string;
toPlace: string;
arriveBy: string;
time: string;
date: string;
routerId: string;
optimize: OptimizeType;
walkSpeed: string;
walkReluctance: string;
locale: string;
mode: string;
showIntermediateStops?: string;
minTransferTime?: string;
transferPenalty?: string;
numItineraries?: string;
walkBoardCost?: string;
bannedAgencies?: string;
}
type OptimizeType =
"FLAT" | "GREENWAYS" | "QUICK" | "SAFE" | "TRANSFERS" | "TRIANGLE";
type PlannerModes = "WALK" | "TRANSIT";
interface OTPPlace {
name: string;
lon: number;
lat: number;
vertedType: "NORMAL";
}
interface OTPItineraries {
duration: number;
startTime: number;
endTime: number;
walkTime: number;
transitTime: number;
waitingTime: number;
walkDistance: number;
walkLimitExceeded: boolean;
generalizedCost: number;
elevationLost: number;
elevationGained: number;
transfers: number;
legs: OTPLegs[];
}
interface OTPLegs {
startTime: number;
endTime: number;
departureDelay: number;
arrivalDelay: number;
realTime: boolean;
distance: number;
generalizedCost: number;
pathway: boolean;
mode: PlannerModes;
transitLeg: boolean;
route: string;
routeColor?: string;
routeId?: string;
routeLongName?: string;
routeShortName?: string;
routeTextColor?: string;
routeType?: number;
agencyTimeZoneOffset: number;
interlineWithPreviousLeg: boolean;
from: OTPPlace;
to: OTPPlace;
legGeometry: {
points: "string";
};
legElevation: string;
steps: OTPStep[];
duration: number;
}
interface OTPStep {
distance: number;
relativeDirection: string;
streetName: string;
absoluteDirection: string;
stayOn: boolean;
area: boolean;
bogusName: boolean;
lon: numbeer;
lat: numbeer;
elevation: string;
walkingBike: boolean;
}
interface OTPPlanOutput {
plan: {
date: number;
from: OTPPlace;
to: OTPPlace;
itineraries: OTPItineraries[];
};
}
+81
View File
@@ -0,0 +1,81 @@
import type { LngLat } from "maplibre-gl";
class RoutePlanner {
fromPlace: LngLat;
toPlace: LngLat;
date: Date;
arriveBy = false;
routerId = "default";
optimize: OptimizeType = "QUICK";
walkSpeed = 1.1112;
walkReluctance = 10;
locale: string = "fr";
mode: Set<PlannerModes> = new Set(["WALK"]);
otpUrl = new URL("https://data.mobilites-m.fr/api/routers/default/plan");
showIntermediateStops?: boolean;
minTransferTime?: number;
transferPenalty?: number;
numItineraries?: number;
walkBoardCost?: number;
bannedAgencies?: string;
constructor(from: LngLat, to: LngLat) {
this.fromPlace = from;
this.toPlace = to;
this.date = new Date();
}
toURLSearchParams() {
const params: PlannerResource = {
fromPlace: `${this.fromPlace.lng},${this.fromPlace.lat}`,
toPlace: `${this.toPlace.lng},${this.toPlace.lat}`,
arriveBy: this.arriveBy.toString(),
date: this.date.toISOString().substring(0, 10),
time: this.date.toISOString().substring(11, 16),
routerId: this.routerId,
optimize: this.optimize,
walkSpeed: this.walkSpeed.toString(),
walkReluctance: this.walkReluctance.toString(),
locale: this.locale,
mode: Array.from(this.mode.values()).join(","),
};
if (this.showIntermediateStops) {
params["showIntermediateStops"] = this.showIntermediateStops.toString();
}
if (this.minTransferTime) {
params["minTransferTime"] = this.minTransferTime.toString();
}
if (this.transferPenalty) {
params["transferPenalty"] = this.transferPenalty.toString();
}
if (this.numItineraries) {
params["numItineraries"] = this.numItineraries.toString();
}
if (this.walkBoardCost) {
params["walkBoardCost"] = this.walkBoardCost.toString();
}
if (this.bannedAgencies) {
params["bannedAgencies"] = this.bannedAgencies.toString();
}
return new URLSearchParams(params);
}
async request() {
this.otpUrl.search = this.toURLSearchParams().toString();
return await $fetch<OTPPlanOutput>(this.otpUrl.toString());
}
}
class TransitRoutePlanner extends RoutePlanner {
override mode = new Set<PlannerModes>(["WALK", "TRANSIT"]);
override showIntermediateStops = true;
override minTransferTime = 60;
override transferPenalty = 60;
override numItineraries = 2;
override walkBoardCost = 300;
override bannedAgencies = "MCO:MCO";
}
export { RoutePlanner, TransitRoutePlanner };
+18 -6
View File
@@ -1,12 +1,24 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
compatibilityDate: "2025-07-15",
devtools: { enabled: true },
modules: ["@nuxt/eslint", "nuxt-maplibre"],
vite: {
optimizeDeps: {
// noDiscovery: true,
// include: ["maplibre-gl"],
devtools: { enabled: false },
modules: ["@nuxt/eslint", "nuxt-maplibre", "@pinia/nuxt"],
ssr: true,
hooks: {
"pages:extend"(pages) {
// add a route
pages.push({
name: "lines",
path: "/lines/:line_id()",
file: "~/pages/index.vue",
meta: { key: "lines" },
});
pages.push({
name: "lines/cluster",
path: "/lines/:line_id()/cluster/:cluster_id()",
file: "~/pages/index.vue",
meta: { key: "lines" },
});
},
},
});
+159
View File
@@ -7,11 +7,14 @@
"name": "better-mrso",
"hasInstallScript": true,
"dependencies": {
"@googlemaps/polyline-codec": "^1.0.28",
"@nuxt/eslint": "^1.16.0",
"@pinia/nuxt": "^0.11.3",
"@types/geojson": "^7946.0.16",
"eslint": "^10.6.0",
"nuxt": "^4.4.8",
"nuxt-maplibre": "^1.2.2",
"pinia": "^3.0.4",
"vue": "^3.5.38",
"vue-router": "^5.1.0"
}
@@ -1186,6 +1189,12 @@
"node": "^20.19.0 || ^22.13.0 || >=24"
}
},
"node_modules/@googlemaps/polyline-codec": {
"version": "1.0.28",
"resolved": "https://registry.npmjs.org/@googlemaps/polyline-codec/-/polyline-codec-1.0.28.tgz",
"integrity": "sha512-m7rh8sbxlrHvebXEweBHX8r1uPtToPRYxWDD6p6k2YG8hyhBe0Wi6xRUVFpxpEseMNgF+OBotFQC5senj8K7TQ==",
"license": "Apache-2.0"
},
"node_modules/@humanfs/core": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz",
@@ -3471,6 +3480,21 @@
"url": "https://opencollective.com/parcel"
}
},
"node_modules/@pinia/nuxt": {
"version": "0.11.3",
"resolved": "https://registry.npmjs.org/@pinia/nuxt/-/nuxt-0.11.3.tgz",
"integrity": "sha512-7WVNHpWx4qAEzOlnyrRC88kYrwnlR/PrThWT0XI1dSNyUAXu/KBv9oR37uCgYkZroqP5jn8DfzbkNF3BtKvE9w==",
"license": "MIT",
"dependencies": {
"@nuxt/kit": "^4.2.0"
},
"funding": {
"url": "https://github.com/sponsors/posva"
},
"peerDependencies": {
"pinia": "^3.0.4"
}
},
"node_modules/@pkgjs/parseargs": {
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
@@ -6231,6 +6255,21 @@
"integrity": "sha512-UaXxwISYJPTr9hwQxMFYZ7kNhSXboMXP+Z3TRX6f1/NyaGPfuNUZOWP1pUEb75B2HjfklIYLVRfWiFZJyC6Npg==",
"license": "MIT"
},
"node_modules/copy-anything": {
"version": "4.0.5",
"resolved": "https://registry.npmjs.org/copy-anything/-/copy-anything-4.0.5.tgz",
"integrity": "sha512-7Vv6asjS4gMOuILabD3l739tsaxFQmC+a7pLZm02zyvs8p977bL3zEgq3yDk5rn9B0PbYgIv++jmHcuUab4RhA==",
"license": "MIT",
"dependencies": {
"is-what": "^5.2.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/mesqueeb"
}
},
"node_modules/core-js-compat": {
"version": "3.49.0",
"resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.49.0.tgz",
@@ -8485,6 +8524,18 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/is-what": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/is-what/-/is-what-5.5.0.tgz",
"integrity": "sha512-oG7cgbmg5kLYae2N5IVd3jm2s+vldjxJzK1pcu9LfpGuQ93MQSzo0okvRna+7y5ifrD+20FE8FvjusyGaz14fw==",
"license": "MIT",
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/mesqueeb"
}
},
"node_modules/is-wsl": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.1.tgz",
@@ -9324,6 +9375,12 @@
"node": ">= 18"
}
},
"node_modules/mitt": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz",
"integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==",
"license": "MIT"
},
"node_modules/mlly": {
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/mlly/-/mlly-1.8.2.tgz",
@@ -10574,6 +10631,81 @@
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/pinia": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/pinia/-/pinia-3.0.4.tgz",
"integrity": "sha512-l7pqLUFTI/+ESXn6k3nu30ZIzW5E2WZF/LaHJEpoq6ElcLD+wduZoB2kBN19du6K/4FDpPMazY2wJr+IndBtQw==",
"license": "MIT",
"dependencies": {
"@vue/devtools-api": "^7.7.7"
},
"funding": {
"url": "https://github.com/sponsors/posva"
},
"peerDependencies": {
"typescript": ">=4.5.0",
"vue": "^3.5.11"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
}
},
"node_modules/pinia/node_modules/@vue/devtools-api": {
"version": "7.7.10",
"resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-7.7.10.tgz",
"integrity": "sha512-KxtEpUOOpFz/qOGRrAwA36QF7DqIA+FXgCYit9mk9wjbaZt0sXOFz81ElOZtKA4HbWHUdwNjZHBFsFFyp5BZiA==",
"license": "MIT",
"dependencies": {
"@vue/devtools-kit": "^7.7.10"
}
},
"node_modules/pinia/node_modules/@vue/devtools-kit": {
"version": "7.7.10",
"resolved": "https://registry.npmjs.org/@vue/devtools-kit/-/devtools-kit-7.7.10.tgz",
"integrity": "sha512-3WNi2Kq4tbpVbmhml7RiphmAt0279oh3fKNeWMQIrltfX8Q91b4i5PL8DtyNKdwmcsGrV4fg+erwWOmD05CLIw==",
"license": "MIT",
"dependencies": {
"@vue/devtools-shared": "^7.7.10",
"birpc": "^2.3.0",
"hookable": "^5.5.3",
"mitt": "^3.0.1",
"perfect-debounce": "^1.0.0",
"speakingurl": "^14.0.1",
"superjson": "^2.2.2"
}
},
"node_modules/pinia/node_modules/@vue/devtools-shared": {
"version": "7.7.10",
"resolved": "https://registry.npmjs.org/@vue/devtools-shared/-/devtools-shared-7.7.10.tgz",
"integrity": "sha512-wOPslzB8vTvpxwdaOcR2qAbwmuSP0L+rhpoC6Cf56V3Jip+HWb7PQQXOUPgBNQARpXsbQX/+mvi8kKucmBGRwQ==",
"license": "MIT",
"dependencies": {
"rfdc": "^1.4.1"
}
},
"node_modules/pinia/node_modules/birpc": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/birpc/-/birpc-2.9.0.tgz",
"integrity": "sha512-KrayHS5pBi69Xi9JmvoqrIgYGDkD6mcSe/i6YKi3w5kekCLzrX4+nawcXqrj2tIp50Kw/mT/s3p+GVK0A0sKxw==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/antfu"
}
},
"node_modules/pinia/node_modules/hookable": {
"version": "5.5.3",
"resolved": "https://registry.npmjs.org/hookable/-/hookable-5.5.3.tgz",
"integrity": "sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==",
"license": "MIT"
},
"node_modules/pinia/node_modules/perfect-debounce": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/perfect-debounce/-/perfect-debounce-1.0.0.tgz",
"integrity": "sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==",
"license": "MIT"
},
"node_modules/pkg-types": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-2.3.1.tgz",
@@ -11422,6 +11554,12 @@
"node": ">=0.10.0"
}
},
"node_modules/rfdc": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz",
"integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==",
"license": "MIT"
},
"node_modules/rolldown": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.1.4.tgz",
@@ -11882,6 +12020,15 @@
"integrity": "sha512-CWLcCCH7VLu13TgOH+r8p1O/Znwhqv/dbb6lqWy67G+pT1kHmeD/+V36AVb/vq8QMIQwVShJ6Ssl5FPh0fuSdw==",
"license": "CC0-1.0"
},
"node_modules/speakingurl": {
"version": "14.0.1",
"resolved": "https://registry.npmjs.org/speakingurl/-/speakingurl-14.0.1.tgz",
"integrity": "sha512-1POYv7uv2gXoyGFpBCmpDVSNV74IfsWlDW216UPjbWufNf+bSU6GdbDsxdcxtfwb4xlI3yxzOTKClUosxARYrQ==",
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/srvx": {
"version": "0.11.21",
"resolved": "https://registry.npmjs.org/srvx/-/srvx-0.11.21.tgz",
@@ -12104,6 +12251,18 @@
"postcss": "^8.5.15"
}
},
"node_modules/superjson": {
"version": "2.2.6",
"resolved": "https://registry.npmjs.org/superjson/-/superjson-2.2.6.tgz",
"integrity": "sha512-H+ue8Zo4vJmV2nRjpx86P35lzwDT3nItnIsocgumgr0hHMQ+ZGq5vrERg9kJBo5AWGmxZDhzDo+WVIJqkB0cGA==",
"license": "MIT",
"dependencies": {
"copy-anything": "^4"
},
"engines": {
"node": ">=16"
}
},
"node_modules/supports-color": {
"version": "10.2.2",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-10.2.2.tgz",
+3
View File
@@ -10,11 +10,14 @@
"postinstall": "nuxt prepare"
},
"dependencies": {
"@googlemaps/polyline-codec": "^1.0.28",
"@nuxt/eslint": "^1.16.0",
"@pinia/nuxt": "^0.11.3",
"@types/geojson": "^7946.0.16",
"eslint": "^10.6.0",
"nuxt": "^4.4.8",
"nuxt-maplibre": "^1.2.2",
"pinia": "^3.0.4",
"vue": "^3.5.38",
"vue-router": "^5.1.0"
}
BIN
View File
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long