Skip to content

vasile/transit-map

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

This project animates vehicles (markers) on a map using the public transport timetables to interpolate their positions along the routes (polylines).

NEW: Plug and play your GTFS files ! Check the GTFS-viz for more information.

Swiss railways(SBB) SBB network - http://simcity.vasile.ch/sbb/

Live applications using this project

Swiss railways(SBB) Romanian railways(CFR) Lausanne (TL) Brașov (RAT) Grenoble (TAG) Genève (TPG)

Install

You need is a webserver(i.e. Apache) and a (modern) browser.

Steps:

  • clone / download the project in a location that can be accessible via your webserver
  • access the project in the browser (i.e. http://localhost/transit-map/ ).

You should already see some action on the map !

Customize

Parameters in config.js

File static/js/config.js

Key Required Sample Value Description
center.x YES 8.540 Longitude of the map center. Values in decimal degrees.
center.x YES 47.378 Latitude of the map center. Values in decimal degrees.
map_type_id YES roadmap Initial map type. Values: roadmap, satellite, terrain, stamen
zoom.start YES 13 Initial map zoom level. Values from 1 to 21.
zoom.min 7 Minimum map zoo level.
zoom.max 7 Maximum map zoo level.
zoom.to_stops YES 17 Zoom to this value when a stop(station) is clicked / selected
zoom.roadmap.stops_min 15 Minimum zoom level for which the stops(stations) layer is visible when the roadmap view is rendered
zoom.roadmap.stops_max 20 Maximum zoom level ...
zoom.roadmap.shapes_min 7 Minimum zoom level for which the shapes(tracks) ...
zoom.roadmap.shapes_min 20 Maximum zoom level ...
zoom.satellite.stops_min 15 Minimum zoom level for which the stops(stations) layer is visible when the satellite view is rendered
zoom.satellite.stops_max 20 Maximum zoom level ...
zoom.satellite.shapes_min 7 Minimum zoom level for which the shapes(tracks) ...
zoom.satellite.shapes_min 18 Maximum zoom level ...
zoom.vehicle_follow YES 17 Zoom to this value when a vehicle is "followed"
zoom.vehicle_mouseover_min YES 7 Prohibit vehicle popups when hovering under this zoom value
ft_layer_ids.mask string Fusion Table ID of the area mask. Example: SBB network mask
ft_layer_ids.gtfs_shapes string Fusion Table ID of the GTFS shapes. Example: SF Muni shapes
ft_layer_ids.gtfs_stops string Fusion Table ID of the GTFS stops. Example: SF Muni stops
ft_layer_ids.topology_edges string Fusion Table ID of the custom network edges. Example: SBB edges . Use this for non-GTFS projects
ft_layer_ids.topology_stations string Fusion Table ID of the custom network stations. Example: SBB edges . Use this for non-GTFS projects
api_paths.trips YES api/getTrips/[hhmm] Vehicles (or GTFS trips) API with all vehicles that run at given hhmm - hour minutes.
api_paths.departures api/getDepartures/[stop_id]/[hhmm] Departures API of the vehicles that stop in [stop_id] station at given [hhmm] time.
geojson.gtfs_shapes YES api/geojson/gtfs_shapes.json GeoJSON FeatureCollection with the GTFS shapes. *This param is not required if geojson.topology_ are used.
geojson.gtfs_stops YES api/geojson/gtfs_shapes.json GeoJSON FeatureCollection with the GTFS stops. This param is not required if geojson.topology_ are used.*
geojson.topology_edges static/geojson/edges-sbb.json GeoJSON FeatureCollection with the network edges. This param is required if the project is NOT GTFS based.
geojson.topology_stations static/geojson/edges-sbb.json GeoJSON FeatureCollection with the network stations. This param is required if the project is NOT GTFS based.
routes Hash JS Hash containing the route defintions.**

Notes:

  • no one of the FT Layers are needed, they are just used for displaying the network stations and lines on the map.
  • ft_layer_ids.gtfs_* and ft_layer_ids.topology_* are mutually exclusive, the first one should be used if the project is GTFS-based . Same for geojson.gtfs_* vs geojson.topology_* keys
  • check the GTFS-viz script if you plan to animate a GTFS dataset

Override parameters

All the config parameters above can be overriden using query string parameters, for instance add ?center.x=8.2&center.y=46.9 to override the map center.

Other parameters

In addition to these, other optional parameters can be used as querystring parameters or in the config.js

Key Sample Value Description
hms 10:20:30 Override time of day, using hh:mm:vv format
time_multiply 10 Accelerate the simulation :) Possible values: 1, 5, 10, 100
view_mode iframe Will remove the info panel; suitable for IFRAME integrations
vehicle_name ICN10017 The application will try to locate the vehicle by name and follow it
vehicle_id string Same as above for vehicle_id

Examples:

Contact ?

Have other questions or do you want to use this application for your area and got stuck ?

Then ping me on Twitter or drop me a line.

License

Copyright (c) 2014 Vasile Coțovanu - http://www.vasile.ch

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

  • The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

  • THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.