GithubHelp home page GithubHelp logo

vasile / transit-map Goto Github PK

View Code? Open in Web Editor NEW
351.0 40.0 91.0 3.5 MB

The server and client used in transit map simulations like swisstrains.ch

Home Page: http://simcity.vasile.ch/sbb/

License: MIT License

PHP 10.45% CSS 3.81% JavaScript 80.81% ApacheConf 0.31% HTML 4.61%

transit-map's Introduction

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.

transit-map's People

Contributors

luciancancescu avatar vasile avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

transit-map's Issues

(Feature Request) Add ZVV API

Would be cool to have the ZVV API with Tram/Bus and more in the Map. For example for Zurich City that you could follow a tram or a bus.

hms querystring

Hello!

I'm trying to override the time parameter, but I can't. All the other parameters works fine (i.e. time_multiply, view_mode) except hms, which only sets the time to 09:00:00.

Its something that I need to update here? Just grabed the last version and the issue still persists.

Gude.

Question

Hello.

Great project. I have just a quick question. I know that one can get the location of the stations and the time table from the SBB opendata API. But where did you get the paths of the train tracks? Is this also available from a public API somewhere?
Thanks a lot.
Cheers,
Tobias

api/getTrips/ URL not found

When using transit-map (after setup with GTFS-viz), I got errors in the javascript console, like these ones, that prevent any line to display:

http://tag.acolytesanonymes.org/api/getTrips/2228 Failed to load resource: the server responded with a status of 404 (Not Found)
http://tag.acolytesanonymes.org/api/getTrips/2229 Failed to load resource: the server responded with a status of 404 (Not Found)
XHR finished loading: GET "http://tag.acolytesanonymes.org/api/getTrips/2229".
http://tag.acolytesanonymes.org/api/getTrips/2230 Failed to load resource: the server responded with a status of 404 (Not Found)

How can I fix this?

Do you need the GTFS-RT feed?

Hi vasile,

I have seen that you write on the upper right corner of your maps-page that your map uses the GTFS-RT feed for realtime updates. Is this also the case for the code you have submitted on github? I am a bit confused because you write that this is a new feature but I can't see any commit about this topic.

Kind regards,
marco

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.