GTFS Display Map¶
Adds maps to GTFS Display. Route shapes and stop geometry from your imported feed are drawn with MapLibre GL over a basemap style you choose.
What it adds¶
- A computed geodata field on GTFS rows and a
gtfs_geodatafield formatter that renders it as a map, so a route or a stop can show its own geometry anywhere Drupal renders fields. - Route shapes drawn from the feed's own
shapes.txt, with stop points alongside them. - A
map_tooltipview mode, laid out per bundle, so what appears when someone taps a stop is a display setting rather than a template override. Layouts ship for routes, stops and trips. - One site-wide basemap style URL: change it once and every map follows.
MapLibre GL and the pmtiles protocol handler are bundled in js/vendor/, so there is no
build step and no CDN request at runtime.
Requirements¶
- GTFS Display 3.x, which in turn requires GTFS Core and GTFS Realtime
- Element Class Formatter
Installation¶
composer require drupal/gtfs_display_map
Configuration¶
Administration › GTFS › Displays › Map settings (/admin/gtfs/display/map/settings).
The only setting is Style URL. Leave it empty to use the bundled style, or point it at any MapLibre GL style document, local or remote. A remote style host must send CORS headers.
Give a local style as a path relative to the Drupal root, such as
modules/custom/my_module/json/basemap.json, not as an absolute server path: the
setting lives in exported config, and /code/web/... on one host is a missing file on the
next. If the style cannot be read or is not valid JSON, the map falls back to the bundled
style and a warning naming the bad Style URL is logged to the gtfs_display_map channel.
Tooltip layouts are at Manage display for each GTFS row bundle, under the Map tooltip view mode.
Basemap coverage¶
Read this before deploying outside California.
The bundled default style (js/basemap.json) is a style document, not a tile set. It
pulls its actual map data from three hosts run by the maintainers:
| What | Where | Coverage |
|---|---|---|
| Vector tiles | public.tiles.gtfs.media/california.pmtiles |
California only |
| Glyphs | fonts.gtfs.media |
worldwide |
| Sprites | sprites.gtfs.media |
worldwide |
So a site mapping anywhere outside California gets a blank basemap by default, with the route and stop geometry still drawn on top of it. Planet-wide tiles are in progress.
Until then, set Style URL to your own style. Any MapLibre GL style works — a self-hosted pmtiles archive, a commercial tile provider, or your own vector tile server. The route and stop layers this module draws sit on top of whatever basemap the style provides and do not depend on it.
Issues¶
File issues and merge requests at https://www.drupal.org/project/issues/gtfs_display_map.
Related modules¶
- GTFS Core — the entities, the importer and the API everything else reads
- GTFS Realtime — trip updates, vehicle positions and service alerts
- GTFS Display — stop, route and system displays for public screens
- GTFS Display Map RT — live vehicles, and an embeddable map
- GTFS Schedule — readable timetables
- GTFS 511 — feed provisioning from the 511 SF Bay API
- GTFS+ — the GTFS+ extension files
Maintainers¶
This project has been sponsored by: