Skip to content

Repository files navigation

KentKart GTFS Data Generator & viewer

A product of, "hey, i could probably do this."

Available for viewing @ https://egezenn.github.io/kk-gtfs/map

to run:

git clone https://github.com/Egezenn/kk-gtfs
uv run kk-gtfs.py
usage: kk-gtfs.py [-h] [-r REGION] [-d DELAY] [-f]

Kentkart GTFS Generator

options:
  -h, --help            show this help message and exit
  -r, --region REGION   Region code (default: ALL)
  -d, --delay DELAY     Delay in seconds between requests (default: 0)
  -f, --force           Force regenerate existing GTFS feed zips

Publicly available API endpoints

City metadata: https://service.kentkart.com/rl1/api/v2.0/city
Stop & Route list: https://service.kentkart.com/rl1/web/nearest/find?region={region}&lang=tr
Route information: https://service.kentkart.com/rl1/web/pathInfo?region={region}&lang=tr&direction={direction}&displayRouteCode={display_code}&resultType={resultType}

  • direction: Route direction (e.g. 0 for outbound, 1 for inbound).
  • resultType: 6-digit binary-like bitmask controlling which sub-lists are populated in the response to optimize payload size:
    • 100000 -> pointList: Geo-coordinates representing the route path polyline.
    • 010000 -> busList: Live vehicle tracking coordinates/information for active buses on the route.
    • 001000 -> busStopList: List of physical stops in sequential order.
    • 000100 -> timeTableList: Departure timetables.
    • 000010 -> scheduleList: Detailed calendar-based schedules and trip departure lists.
    • 000001 -> Reserved / Unused.
    • Omitting resultType (or passing 111111) defaults to returning all sub-lists. Nearest buses: https://service.kentkart.com/rl1/web/nearest/bus?region={region}&lang=tr&lat={lat}&lng={lon}&busStopId={stop_id}

Hardcoded Assumptions

Because the KentKart API endpoints do not provide all required fields to generate a strictly compliant GTFS feed, the generator enforces the following hardcoded baseline assumptions:

  • Agency URL: Defaulted to https://www.kentkart.com/ (agency.txt) (per municipality support mails are sometimes available in city metadata as supportEmail, supportCCEmail)
  • Agency Timezone: Defaulted to Europe/Istanbul (agency.txt)
  • Route Type: Extracted from routeType in the route list API (defaults to 3 - Bus if missing). Kentkart supports various modes including Bus (3), Ferry (4), Tram (0), Funicular (7) and Rail (2) in certain regions like Kocaeli, Antalya, and Gaziantep.
  • Calendar Dates: Service ID dates are set with a start boundary of the generation date and an end boundary of +60 days (calendar.txt)
  • Stop Arrivals: The API only provides a time offset from the first stop, so all intermediate arrival and departure times are calculated relative to the trip's starting time.

Data Access

https://github.com/Egezenn/kk-gtfs/raw/main/data/{municipality}.zip

  • GitHub Action workflow fetches and pushes updates every: 1st of every month at 03:00 (UTC+3)
  • Data expiry: 2 months after generation at 06:00 (UTC+3)

License

The source code in this repository is released into the public domain under MIT License.

The GTFS datasets generated by this tool are derived from KentKart API endpoints. The data is licensed under CC0 1.0 Universal Public Domain Dedication. Note that the underlying data and its copyright belongs to its respective owners (KentKart and/or the respective municipal authorities). This dedication only applies to any copyrightable compilation or formatting efforts introduced by this tool.

About

GTFS formatında KentKart kullanan belediyelerin otobüs hatları ve görüntüleyicisi

Topics

Resources

Stars

6 stars

Watchers

1 watching

Forks

Contributors

Languages