Skip to content

transitlos.flex.export

Files for the browser: the compact binary tables the front-end needs to recompute scores and catchments (see frontend/).

export_for_browser(out_dir, lat, lon, prof, res, params, counts=None, count_labels=None)

writes meta.json sizes, bbox, the default ScoreParams (JSON), the shape catalog, the names of the census count columns stop_{mode,h,v,np}.bin station profiles int8 / float32 / float32 [SP], int32 [S]; stop_lonlat.bin float32 [S2] cell_station.bin, cell_dist.bin int32 [ncK], uint16 [ncK] cell_counts.bin float32 [ncncol]: census counts of each cell (population, jobs, ...), the numbers summed per winning stop cell_geom.bin float32 [nc14]: centre then 6 vertices, lon,lat (the demo viewer draws these; a production map gets geometry from tiles) viewer.html, score.js, editor.js, glmap.js copied from frontend/

shape_catalog()

Presets for each curve, as tables (JSON), keyed by name -- what a UI offers in its 'shape' drop-downs.

publish_frontend(out)

Copies the scripts and writes the stamped, version-addressed viewer page into out.

Parameters:

Name Type Description Default
out

Output folder of the map.

required

export_for_browser(out_dir, lat, lon, prof, res, params=DEFAULT, geometry=True, counts=None, count_labels=None, extra_meta=None, points=None)

points (optional DataFrame: stop_lon, stop_lat, station, stop_name): the real stop_ids drawn on the map (each coloured/sized/selected as its station).

Parameters:

Name Type Description Default
out_dir

Output folder (created).

required
lat

Station latitudes.

required
lon

Station longitudes.

required
prof

Station profiles.

required
res

Cell stations (:class:CellStops).

required
params ScoreParams

Default scoring parameters.

DEFAULT
geometry bool

Also write the cell geometry.

True
counts

Optional [cells, columns] counts.

None
count_labels

Names of the count columns.

None
extra_meta

Extra fields for meta.json.

None
points

Optional real stops (see above).

None

Returns:

Type Description
dict

The meta.json contents.

export_routes(out_dir, station_lat, station_lon, parts, start_sec, end_sec, tile_deg=0.05, detour=1.3, simplify_m=8.0)

Route data of the map editor (frontend/edit.js): which routes serve each station and their departures, so the browser can change a route (speed, headway, mode, deleted) and rebuild the profiles of the stations it serves exactly as profiles.feed_candidates + select do.

writes routes/routes.json window, detour factor, the routes (id, name, colours, mode, stations) and the departure tiles (per tile its stations and their offsets) routes/lines.json GeoJSON of the routes' main shapes (property r = route index), simplified routes/dep_.bin per tile (n departures, sorted by station, route, direction, time): float32 dist_m[n], float32 time_s[n], uint16 t[n] (s after the window start), uint16 route[n], uint8 sector[n], uint8 rank[n] (0 bus 1 tram 2 rail), uint8 part[n] (the parent station of a feed group it belongs to: the server builds the candidates of each part on its own and pools them at a station several parts share)

Parameters:

Name Type Description Default
out_dir

The area's browser folder (the one of :func:export_for_browser).

required
station_lat

Latitudes of the exported stations (the station keys of profiles.select).

required
station_lon

Their longitudes.

required
parts

profiles.state_candidates(routes_sink=...) items: (departures, routes, shapes).

required
start_sec float

Start of the scoring window (s after midnight).

required
end_sec float

Its end.

required
tile_deg float

Tile size of the departure files (degrees).

0.05
detour float

Street distance / straight distance of the area (new stations of the editor use it).

1.3
simplify_m float

Simplification tolerance of the route lines (m).

8.0

Returns:

Type Description
dict

Counts of what was written.