This repository contains graphic assets and data for HexaTransit.
Networks are grouped by country:
logo/
├── fr/ ← country (ISO 3166-1 code, lowercase)
│ ├── country.json ← country name per language
│ ├── flag.png ← flag (official proportions)
│ ├── shape.svg ← country outline (see below)
│ ├── idf/ ← network "fr-idf" (= <country>-<folder>)
│ │ ├── lines_picto.csv ← line pictograms
│ │ ├── trafic.json ← service alerts configuration
│ │ ├── transitous.json ← Transitous feeds of the network
│ │ ├── shapes.geojson ← line paths for the service map (optional)
│ │ ├── rules.json ← data quirks of its feeds (optional, see below)
│ │ ├── idfm.png
│ │ └── metro/, rer/, bus/…
│ └── star/ ← network "fr-star"
└── de/ ← another country, same layout
- The network id is
<country>-<folder>(e.g.fr-idf). It must be theagency_idoflines_picto.csvand thecompanyIdoftrafic.json. lines_picto.phpandtrafic.phpmerge the files of every network.trafic.phpalso addscountry,countryNameandcountryFlagto each network, so the app can group networks by country.countries.phplists the countries (name, flag, outline, number of networks) for the country picker of the app, which shows each country's outline filled with its flag.
Provide logos in good quality (any size): at deployment,
build_images.py shrinks the published copies, without changing the files
of the repository nor their URLs. Line pictograms (in the mode folders) are
reduced to 256 px, network logos and flags to 768 px, so the app downloads
~10 KB per pictogram instead of up to several hundred.
In lines_picto.csv (logoPath) and trafic.json (companyLogo,
lineLogo, lineLogoDark), give logos relative to the network folder:
fr-star;7-1001;A;metro/A.png;SUBWAY;1;0
The PHP scripts publish them as full URLs
(https://hexatransit.fr/assets/logo/fr/star/metro/A.png), so a folder can
be moved without rewriting its files. Paths relative to the repository
(/logo/fr/star/metro/A.png) and full URLs are also accepted.
- Create
logo/<code>/country.json:{ "code": "de", "flag": "DE", "name": { "fr": "Allemagne", "en": "Germany", "de": "Deutschland" } } - Add its flag as
logo/<code>/flag.png(PNG, official proportions, e.g. from the public-domain flags of Wikimedia Commons). - Generate its outline
logo/<code>/shape.svgfrom Natural Earth (public domain), with the ISO 3166-1 alpha-3 code of the country:For a country with distant territories, keep the main land withpython .github/scripts/generate_country_shape.py de DEU--bbox lon_min lat_min lon_max lat_max, e.g. metropolitan France:python .github/scripts/generate_country_shape.py fr FRA --bbox -6 41 10 52. - Add each network in
logo/<code>/<network>/, with the layout above.
python .github/scripts/check_layout.py checks the layout (also run by CI).
In trafic.json, lines is a list of groups: the first item of each group is
its header, the next ones are its lines. The header gives the mode icon
(transportLogo), which also names the group ("Métro", "Train"…). Two
optional fields customize it, e.g. to group the lines by operator:
title: shown instead of the mode name, either a string or the title per language (with at leasten);logo: shown instead of the mode icon (e.g. the operator's logo), path relative to the network folder, like the other logos.
[
{"transportLogo": "assets/icons/transportMode/metro_white.png",
"title": "Tokyo Metro", "logo": "operators/tokyometro.png"},
{"lineId": "TokyoMetro.Ginza", "lineName": "Ginza Line", "lineLogo": "metro/G.png"}
],
[
{"transportLogo": "assets/icons/transportMode/train_white.png",
"title": {"fr": "Autres lignes", "en": "Other lines", "ja": "その他の路線"}},
{"lineId": "TWR.Rinkai", "lineName": "Rinkai Line", "lineLogo": "train/R.png"}
]Keep transportLogo in every header: it is the fallback of logo, and gives
the mode of the lines for the service map.
The app gets its data from Transitous, where every
line is identified as <feed>_<route_id>. Each network folder declares its
feeds in transitous.json:
{ "feeds": ["fr-reseau-urbain-STAR"] }A feed id is the country code followed by the source name in the
Transitous feed list of the country, e.g.
transitous/feeds/fr.json
or de.json.
lines_picto.php then publishes each line_id once per feed, as
<feed>_<line_id>. The line_id in lines_picto.csv and the lineId in
trafic.json must be route_ids of the feed's GTFS. To check (and fix unambiguous mismatches):
python .github/scripts/check_transitous_routes.py --network fr-star --suggest
python .github/scripts/check_transitous_routes.py --network fr-star --fix
The service updates screen of the app has a map showing the disrupted lines.
It draws the paths of shapes.geojson, declared in trafic.json with
"shapes": "shapes.geojson". It is a GeoJSON FeatureCollection with one
Feature per line, identified by its lineId from trafic.json:
{"type": "Feature",
"properties": {"lineId": "IDFM:C01742", "name": "RER A", "color": "#FF1400"},
"geometry": {"type": "MultiLineString", "coordinates": [[[2.04059, 48.93324], …]]}}Generate it from the lines of trafic.json:
python .github/scripts/generate_line_shapes.py --network fr-star
python .github/scripts/generate_line_shapes.py --network fr-idf --source idfm
--source gtfs(default) readsshapes.txtof the GTFS feeds oftransitous.json;--source idfmreads the open data of Île-de-France Mobilités (the IDFM GTFS has noshapes.txt): the tracks of the rail network dataset (metro, RER, train, tram, cable), matched by line id (idrefligc). The line paths dataset is not used for them: each line is a single MultiLineString mixing, without any way to tell them apart, the routes of replacement buses and works detours (metro 13 along boulevard Haussmann, loops around blocks…). It is only a fallback for a line missing from the rail network, redrawn from station to station with the IDFM stops (--no-stopskeeps it as is). Track segments not yet in service are left out;--source geojson:<URL>reads any GeoJSON whose Features carry the line id in--id-property(and its color in--color-property);--line <lineId>regenerates only that line.- when
shapes.geojsonexists, only its lines are regenerated: a line you removed from it stays out.--add-missingalso draws the lines oftrafic.jsonthat have no path (of the modes not left out). - bus lines (groups whose
transportLogois…/bus_white.png) are left out, as they would clutter the map;--skip-mode <mode>chooses the modes to leave out (--skip-mode nonedraws every line).
The generator merges the overlapping variants of a line (directions,
branches) into a single network of paths, so the file stays light. With
--source gtfs, each shape is a whole route: the longest is kept in one
piece and the others only where they leave it by more than 15 m (_cover),
so the two directions of a line on parallel lanes do not take turns piece by
piece (each joint shifts the line in the side-by-side drawing of the app).
Pieces that run a few metres along a kept one are removed, and the ends they
used to join are reconnected (_stitch), so the paths have no gap. At
deployment, build_line_shapes.py turns each shapes.geojson into a compact
shapes.min.json (Google encoded polylines, not versioned), which
trafic.php publishes instead: ~40 KB transferred for the whole IDF.
Format v2 of shapes.min.json also places lines that share a corridor
side by side (e.g. RER A and D in the Châtelet – Gare de Lyon tunnel):
each line gets "slots", one encoded list per path giving, for every point,
its offset in line widths (positive = left of the drawing direction,
encoded like a 1D polyline in tenths). Lines are ranked in trafic.json
order. The app draws these offsets as they are. The HexaTransit server
computes the same offsets for the Transitous paths it serves to the app
(bundleSlots in its src/proxy/shapes.ts): keep both algorithms in step.
The same generation from the GTFS (--source gtfs) is available in the web
editor (Shapes tab, Generate the paths from the GTFS of the network):
gtfs_shapes.php downloads the feeds of transitous.json on the server (only
feeds of the Transitous list, kept 12 h) and returns the raw shapes of the
lines; the editor cleans them like the script (editor/src/shapes-gen.js:
keep both in step). If the server cannot get a feed, the contributor
downloads its GTFS and chooses the .zip, which is read in the browser.
Lines missing from the source keep their existing path, so you can draw the
remaining ones by hand (e.g. with geojson.io) and add
them to the file. Paths are simplified to ~10 m
(the check fails above 5 MB). python .github/scripts/check_line_shapes.py
checks the file (also run by CI).
The app does not download the GTFS-RT feeds (gtfsRTUrl) itself:
alerts.php?network=<companyId> reads each feed at most once a minute for
all users and returns only the alerts of the lines of trafic.json, as
compressed JSON with an ETag (empty 304 when nothing changed). Each alert carries its severity and, when the feed gives them, its GTFS-RT effect and cause (numbers), so the app tells works from a breakdown without reading the text, whatever its language. For the IDF,
~30 KB instead of ~150 KB per refresh. trafic.php publishes its URL as
alerts for every network with a gtfsRTUrl; nothing to add in the
network files. The decoding (gtfs_rt.php) needs no PHP extension other
than curl.
An alert that names a line only together with stops (every
informed_entity of that line has a stop_id: "station closed", "stop not
served") lists them in stops ({lineId: [stopId…]}): the app then marks
those stops on the map instead of the whole line. Their position comes in
places, asked once to Transitous under the feeds of the network's
transitous.json and kept in a permanent cache (at most ~4 s of lookups per
feed read, the rest at the next reads). To test on a saved feed
(--no-places skips the lookups):
php alerts.php --network=fr-idf --feed=alerts.pb
The app knows no network: everything specific to a feed lives in an
optional rules.json in the network folder. rules.php publishes the rules
of every network, indexed by the feeds of its transitous.json, with the
logos as full URLs. The app keeps a copy on the phone; without it, it falls
back to its generic behaviour. All fields are optional:
| Field | Meaning |
|---|---|
modeFixes |
Wrong modes in the feed: {"match", "mode", "fromModes"?}. A trip whose name (displayName, else the line name) matches match gets mode, only when its mode is in fromModes if given. |
brands |
Commercial brands of trains sharing one route: {"match", "name", "logo"?, "modes"?}. A trip whose name matches becomes the line name (one line, one pill and one filter per brand), shown with logo if given, else as a pill with its name. modes limits the brand to these modes. The first match wins: put the most specific first. |
modeLogos |
Logo of the routes without a brand (no name, e.g. the routes of a station), by mode: {"HIGHSPEED_RAIL": "brands/tgv.png"}. |
missionCode |
Pattern of the mission codes published as destination ("^[A-Z][A-Z0-9]{3}$" for the RER): shown as a code next to the real destination. |
trainCategories |
Categories of long-distance trains published as « » (["ICE", "RJX"]): a name like « RE 123 » is then a train number, not a line. Completes the list of rules_global.json. |
copiedLines |
Line names under which the feed republishes trains of another feed (["TER"]): the app hides these copies when the original train is shown. |
markerIcons |
Map marker icon of a stop served by some lines: {"lines", "modes"?, "icon", "name"?}, where lines matches the line name and icon is one of bus, tram, metro, rer, train, ferry, cable. name is what the network calls this kind of line ("RER"): the app shows it in front of the line name (« RER B ») instead of the generic mode (« Suburban train »). |
rules_global.json (repository root) holds the rules that apply to every feed, whatever its network:
for now trainCategories, the categories of long-distance trains of the world (ICE, TGV, RJX…). The
trainCategories of a network's rules.json complete it. rules.php publishes it as "global".
Patterns are regular expressions, case-insensitive except missionCode
(« NORA » is a code, « Orly » a destination). Example
(logo/fr/sncf/rules.json):
{
"modeFixes": [{"match": "^OUIGO\\b", "mode": "HIGHSPEED_RAIL"}],
"brands": [
{"match": "^OUIGO\\b", "name": "OUIGO", "logo": "brands/ouigo.png"},
{"match": "^(TGV INOUI|INOUI|TGV)\\b", "name": "TGV INOUI", "logo": "brands/tgv.png"}
],
"modeLogos": {"HIGHSPEED_RAIL": "brands/tgv.png"}
}python .github/scripts/check_rules.py checks the files (also run by CI);
php rules.php shows the published result.
editor/ is a web page, published at https://hexatransit.fr/assets/editor/, to add or fix
line logos (lines_picto.csv), the Transitous feeds of a network and its rules.json without using Git.
You log in with GitHub; the editor forks the repository, commits your changes to a branch of your fork
and opens the pull request for you. The usual checks (including the app conformity check) then run on it.
- Lines: edit the table, upload a logo (png, jpg or webp); Find lines from a stop lists the
route_ids of the network's feeds from Transitous, so you do not type them by hand. - Tabs: Browse (pick or create a network or country, feeds, network identity), Lines (
lines_picto.csv), Rules (rules.json), Alerts (trafic.json), Shapes (line paths) and Review & submit (pull request). Lines, Rules, Alerts and Shapes need a network picked in Browse; hover a column header or a field for its meaning. - Rules: one section per field of
rules.json(modeFixes,brands,modeLogos,missionCode,trainCategories,copiedLines,markerIconswith its optionalname), each with its explanation (see Network rules above), and a box to try a trip name against every pattern (each pattern shows ✓ matches / · no match / ✗ invalid as you type). - Rows you do not edit are written back unchanged, so the pull request only shows your changes.
- Alerts: the line groups of
trafic.json(what the service alerts screen lists): groups with their mode icon, title (with translations) and logo; lines with id, name, logo image or colour badge, dark logo, disabled; move, reorder, delete, add the lines of the Lines tab that are missing. A new network can be put on the alerts page and then get line paths. - Shapes: click a line to edit its path (replace it, add or remove segments, simplify it, or revert it to the
repository's version), add a path to a line that has none, or import several lines at once from a GeoJSON
(drawn with geojson.io, for example). Paths are simplified to about 10 m, previewed and
checked, and
"shapes"is declared intrafic.jsonif needed. Generate the paths from the GTFS of the network redraws the lines that have a path from the shapes of its Transitous feeds, likegenerate_line_shapes.py --source gtfs(a line removed from the paths stays out; Also draw the lines without a path adds the others, buses left out by default); the IDFM source stays in the script. - Network identity: name, city, logo and alerts URL of a network (the header of its
trafic.json; only the changed lines appear in the pull request). - Map editor: "Edit points on a map" on a line shows it over a map: drag a point to move it, click or drag a handle between two points to add one, right-click a point to delete it, draw a new segment, undo and redo.
- Logos can be SVG: they are drawn on a canvas and sent as a 512 px PNG (an SVG with scripts is refused).
- Edit an existing country (names, flag, outline) and rename a network folder (its files move without being re-uploaded;
agency_idandcompanyIdfollow; rename a network to fix a mistake: the app uses its id for favourites and alerts). - Networks and countries: create or delete a network, or a whole country (code, names, flag and an outline
generated from Natural Earth, like
generate_country_shape.py). Deletions are listed in the review and can be undone before you submit. - Everything done in one session (several networks, countries, deletions) goes into a single pull request.
- Your work is saved in your browser as you go (IndexedDB): after a closed tab or an expired session, the editor offers to
restore it. Before sending, it checks that nobody changed the same files on
mainmeanwhile (they would be overwritten). - After sending, the Review tab follows the pull request: state, checks (with the reason when the app's tests fail) and, if something must be fixed, Update the pull request rebuilds its branch from the current work (no second PR; it is refused if someone else added commits to the branch). A merged PR offers to start over.
- Links:
https://hexatransit.fr/assets/editor/#/fr-idf/shapes/IDFM%3AC01742opens a network, a tab (lines,rules,shapes,review) and a line; the address follows what you do, so you can share it (or use it from the app to point to a line). - Not covered: nothing of the network files; the structure of
.github/and the PHP scripts stay pull requests as below.
Maintainers: the login needs a small server-side exchange, see editor/README.md.
Tests: node --test editor/tests/*.test.mjs (also run by the CI).
-
Fork the repository and clone your fork locally.
-
Create a branch for your contribution:
git checkout -b your-branch-name -
Add or modify the necessary files, following the structure:
- Place new logos in the correct subfolder (
logo/<country>/<network>/<mode>/). - Update
lines_picto.csvortrafic.jsonif needed.
- Place new logos in the correct subfolder (
-
Respect the file formats
-
Add a clear description to your Pull Request:
- Explain the purpose of the contribution.
- List the files/folders modified or added.
- Mention any important points (e.g., format, copyright, etc.).
-
Ensure your contribution does not delete existing files (unless intentional and justified).
-
Submit the Pull Request to the
mainbranch of the original repository.
### Add logos for Rennes Metro Line 5
- Added SVG files in `logo/fr/star/metro/`
- Updated `lines_picto.csv` to include line 5
- No existing files deleted
Thank you for contributing to HexaTransit assets!