diff --git a/website/demo.ts b/website/demo.ts index 219a072..cf7092b 100644 --- a/website/demo.ts +++ b/website/demo.ts @@ -98,7 +98,7 @@ function renderActiveCalendars() { // Render routes list function renderRoutes() { const routesListEl = document.getElementById('routes-list')!; - const routes = gtfs.getAllRoutes(); + const routes = gtfs.getRoutes(); if (routes.length === 0) { routesListEl.innerHTML = '
No routes found
'; diff --git a/website/index.html b/website/index.html index 33753b6..8a9da81 100644 --- a/website/index.html +++ b/website/index.html @@ -67,17 +67,19 @@import { GtfsSqlJs } from 'gtfs-sqljs';
-// Load from ZIP file
-const gtfs = await GtfsSqlJs.fromZip('https://example.com/gtfs.zip');
+// Load from ZIP file (skip shapes.txt to reduce memory)
+const gtfs = await GtfsSqlJs.fromZip('https://example.com/gtfs.zip', {
+ skipFiles: ['shapes.txt']
+});
-// Get all routes
-const routes = gtfs.getAllRoutes();
+// Get all routes (using flexible API)
+const routes = gtfs.getRoutes();
// Get stops for a trip
-const stops = gtfs.getStopsByTrip('trip_id');
+const stops = gtfs.getStops({ tripId: 'trip_id' });
// Get active trips for a date
-const trips = gtfs.getTripsByDate('20240115');
+const trips = gtfs.getTrips({ date: '20240115' });
// Clean up
gtfs.close();
@@ -101,20 +103,12 @@ getStopById(stopId) - Get stop by IDgetStopByCode(stopCode) - Get stop by codesearchStopsByName(name, limit?) - Search stops by namegetStopsByTrip(tripId) - Get stops for a trip (ordered)getAllStops(limit?) - Get all stopsgetRouteById(routeId) - Get route by IDgetAllRoutes(limit?) - Get all routesgetRoutesByAgency(agencyId) - Get routes by agencygetTripById(tripId) - Get trip by IDgetAgencyById(agencyId) - Get agency by IDgetActiveServiceIds(date) - Get active services for a date (YYYYMMDD)getCalendarByServiceId(serviceId) - Get calendar by service IDgetCalendarDates(serviceId) - Get calendar date exceptionsgetCalendarDatesForDate(date) - Get exceptions for a specific dategetTripById(tripId) - Get trip by IDgetTripsByRoute(routeId) - Get trips for a routegetTripsByDate(date) - Get all trips for a dategetTripsByRouteAndDate(routeId, date) - Get trips for route and dategetTripsByRouteAndDateAndDirection(routeId, date, directionId) - Filter by directiongetStopTimesByTrip(tripId) - Get stop times for a tripgetStopTimesByStop(stopId, limit?) - Get stop times for a stopgetStopTimesForStopRouteAndDate(stopId, routeId, date, directionId?) - Complex filteringgetStopTimesByTrip(tripId) - Get stop times for a trip (ordered by stop_sequence)