Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/app/components/GtfsVisualizationMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,12 @@ export const GtfsVisualizationMap = ({
out.push(s);
}
}
out.sort((a, b) =>
a.name.localeCompare(b.name, undefined, { sensitivity: 'base' }),
);
out.sort((a, b) => {
if (a.sequence != null && b.sequence != null) {
return a.sequence - b.sequence;
}
return 0;
});
setSelectedRouteStops(out);
}
}, [filteredRoutes]);
Expand Down
1 change: 1 addition & 0 deletions src/app/components/MapElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export interface MapStopElement extends BaseMapElement {
stopId: string;
stopLat: number;
stopLon: number;
sequence?: number;
}

export type MapElementType = MapRouteElement | MapStopElement;
Expand Down
16 changes: 13 additions & 3 deletions src/app/utils/precompute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,12 @@ export function createPrecomputation(deps: PrecomputeDeps): {
const stopId = String(f.properties?.stop_id ?? '');
const stopName = String(f.properties?.stop_name ?? '');
const locationType = Number(f.properties?.location_type ?? 0);
const sequence =
f.properties?.stop_sequence != null
? Number(f.properties.stop_sequence)
: f.properties?.sequence != null
? Number(f.properties.sequence)
: undefined;

const routeIds = extractRouteIds(f.properties?.route_ids);
if (routeIds.length === 0) continue;
Expand All @@ -265,6 +271,7 @@ export function createPrecomputation(deps: PrecomputeDeps): {
stopId,
stopLat: lat2,
stopLon: lon2,
sequence,
});
}

Expand All @@ -280,9 +287,12 @@ export function createPrecomputation(deps: PrecomputeDeps): {
routeIdToBBoxRef.current = idToBBox;
routeTypeToBBoxRef.current = typeToBBox;
Object.keys(byRouteId).forEach((rid) => {
byRouteId[rid].sort((a, b) =>
a.name.localeCompare(b.stopId, undefined, { sensitivity: 'base' }),
);
byRouteId[rid].sort((a, b) => {
if (a.sequence != null && b.sequence != null) {
return a.sequence - b.sequence;
}
return 0;
});
});
stopsByRouteIdRef.current = byRouteId;

Expand Down