This post describes an update of a previous version. The old version can be found here: https://reactivemusic.net/?p=20329
In the previous version, all of the markers for each train line were deleted and redrawn in a group at the polling interval. In this version the train markers move to their new location when the data is polled.
The map is drawn using Leaflet. The moving marker library is from Ivan Sanchez https://www.npmjs.com/package/leaflet.marker.slideto
The project uses the MBTA JSON API, to query vehicle data for each train line. the geo coordinates of the trains are sent via websockets to the client map page.
This project is a work in progress and not available yet.
node server: internetsensors/mbtanode2/index.html
html map client: internetsensors/mbtanode2/mbtatrain2.html
// to run, type node index.js at a command line. // then open a web browser to: http://127.0.0.1:8124/ // type 'go' into the text box below the map, and press 'send' button // in a few seconds the train markers will magically appear