GTFS (General Transit Feed Specification)

GTFS is a standardized format for public transit schedules and associated geographic information. Cassiopeia handles the standard GTFS format automatically with pre-built mapping configurations.

Note: GTFS mappings are provided as part of Cassiopeia. Any issues with GTFS processing should be reported as Cassiopeia system bugs rather than mapping configuration problems.

GTFS Format

GTFS consists of text files that define transit schedules, routes, stops, and related information:

  • stops.txt — Bus stops, stations, and station entrances

  • routes.txt — Transit routes

  • trips.txt — Trips for each route

  • stop_times.txt — Arrival and departure times at stops

  • agency.txt — Transit agencies

  • calendar.txt, calendar_dates.txt — Service dates and exceptions

Available Mappings

Cassiopeia provides pre-built mappings for all major GTFS entities, following the FIWARE Smart Data Models for GTFS:

| Entity | Source File | Key Mappings | GtfsAgency | agency.txt | agency_name → name, agency_url → page, agency_timezone → timeZone | GtfsRoute | routes.txt | route_id → identity, route_short_name → shortName, agency_id → operatedBy | GtfsStation | stops.txt | stop_id → identity, stop_name → name, stop_lat/stop_lon → location (point) | GtfsTrip | trips.txt | trip_id → identity, route_id → route, service_id → service | GtfsStopTime | stop_times.txt | trip_id + stop_sequence → identity, arrival_time → arrivalTime | GtfsShape | shapes.txt | shape_id + shape_pt_sequence → identity, coordinates → location | GtfsCalendar | calendar.txt | service_id → identity, start_date/end_date

Automatic Processing

When you provide GTFS data, Cassiopeia will:

  1. Detect GTFS format by standard file names

  2. Apply the correct mapping for each file

  3. Create relationships between entities (routes to agencies, trips to routes)

  4. Convert GTFS coordinates to GeoJSON format

  5. Generate NGSI-LD entities for each record

Running the Example

cassiopeia map gtfs -i data/gtfs/GtfsBratislava.zip -o output
cassiopeia map gtfs -i data/gtfs/GtfsLjubljanaLpp.zip -o output

Troubleshooting

  • Invalid GTFS format — Ensure files follow the GTFS specification

  • Missing required fields — GTFS requires certain fields to be present

  • Coordinate issues — Verify lat/lon values are valid numbers

  • Encoding — GTFS files should be UTF-8 encoded