Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

GTFS Stop Mapmaker

What this is

A tool and pipeline for generating simplified, custom-styled map backdrops from a transit agency's GTFS stop data, and serving those maps out for an app to use — without requiring a live map-rendering engine, a paid API key, or a server that has to run continuously.

Given a GTFS feed's stops, it produces small binary map files scoped tightly to where those stops actually are, styled however you like (colors, fonts, label size, which categories of information appear), and hands you a static file per agency that can be uploaded and served on demand.

Why it exists

Rendering a live, pannable map is more than a transit app's Map screen actually needs — riders care about accurate, well-styled geography around the stops they use, not a fully interactive map engine. But building that is harder than it looks on a constrained platform: many native map-rendering libraries require capabilities (native code execution, low-level system access) that aren't available in every runtime environment, and the live-server alternatives — a tile-rendering service, a self-hosted tile server — trade one dependency for another: instead of relying on a third-party map provider, you end up owning a process that has to run continuously, get patched, and get paid for indefinitely.

The mapmaker sidesteps both constraints at once. Since a transit app already knows exactly where its stops are, the backdrop can be generated once, offline, scoped tightly to those real locations, and shipped as plain data — geometry an app can draw with nothing more than a Canvas. No native rendering engine required on-device, no live server, no third-party API key that can be revoked or start charging.

What it produces

For a given agency, the mapmaker outputs a compact custom binary format (.picobkdr) — flattened, simplified geometry (water, land, roads, buildings) with all labels and points of interest deliberately excluded, since a consuming app's own overlays (stop pins, live vehicles, route info) already provide that. Two files are typically generated per agency: a stops backdrop and a tighter-zoom stations backdrop, for wherever an app distinguishes a general stop view from a closer, multi-platform station view.

The tool

The mapmaker itself is a single self-contained HTML file — no build step, no install, just open it in a browser. It has two jobs:

1. Design the visual theme. It renders a live map (OpenFreeMap vector tiles via MapLibre) and lets you adjust colors, typography, and which categories of information appear — transit, businesses, health, education, parks, places of worship, each independently toggleable. A handful of built-in presets (a dark theme, a midnight-blue theme, a light paper theme, and a warm colorful theme) provide starting points. These choices determine how every generated backdrop file looks.

2. Generate the backdrop files. Given an agency's GTFS stops.txt — pasted directly, searched via the MobilityData feed catalog, or loaded from an uploaded GTFS zip — the tool:

  • Parses stop coordinates and detects stations
  • Clusters nearby stops so dense areas aren't redundantly scanned
  • Merges clusters into larger scan regions, sized as large as possible while holding a fixed zoom level, so a whole city center becomes one scan instead of dozens without losing detail
  • Scans those regions concurrently across several hidden map instances to cut generation time
  • Simplifies the resulting geometry and packs it into the .picobkdr format
  • Includes a built-in preview that reads a generated file back and draws it, so output can be verified before it's shared anywhere

Sharing the output

Generated files aren't meant to be bundled into a consuming app's install — that doesn't scale as more agencies are added. The intended distribution model is a small backend (a Cloudflare Worker plus R2 object storage, in Pico Transit's case) that serves each agency's files on request, letting a client download and cache them on demand — with conditional-request support (ETag / If-None-Match) so checking for an update doesn't mean re-downloading the whole file.

Current status

  • The tool itself is built and working end to end: theme design, category filtering, typography, GTFS loading (paste/search/upload), region-based parallel scanning, and file preview.
  • Defaults are currently tuned to Pico Transit's Map screen (zoom range 17–20): 2m simplification tolerance, ~300m stop buffer / 150m station buffer, bold 16px labels.
  • Pico Transit's own consumption of these files (a Worker route to serve them, and Android-side parsing/Canvas rendering) is specified but not yet implemented or tested on-device.

Vision

A general-purpose way to turn any GTFS feed into a small, offline-generatable, freely-stylable map backdrop — with no ongoing infrastructure cost, no API key that can be revoked or start charging, and no dependency on a native rendering engine a given platform might not allow. Pico Transit is the first and motivating consumer, but the tool and format aren't specific to it: any app that already knows where its own stops are, and just needs accurate geography underneath them, is a fit.

About

As a backup to direct API calls from the app,creating local versions of maps for maptiles that pull from the radius around GTFS stops

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages