William Lachance's Log: Posts tagged 'Transit'urn:https-wrla-ch:-tags-Transit-html2011-12-14T05:00:00ZAn API for AMT dataurn:https-wrla-ch:-blog-2011-12-an-api-for-amt-data2011-12-14T05:00:00Z2011-12-14T05:00:00ZWilliam Lachance
<p>The <a href="http://www.amt.qc.ca">AMT</a> released their <a href="http://t.co/AofpyI4E">GTFS schedule information</a> to the public earlier this week, which is awesome. Not coincidentally, Montreal is going to have a <a href="http://transportationcamp.org/montreal/">Transportation Camp</a> tomorrow, wherein people will hack on transportation software and discuss open data issues.</p>
<p>GTFS information is useful and standard, but in its raw form it can be a bit difficult to wrangle with. So in advance of the event, I thought it might be helpful/useful to put a simple JSON API to the data, based on my <a href="http://github.com/wlach/routez">routez</a> software. Should be useful for creating an app or two! There’s two endpoints that are currently defined:</p>
<p><code>/api/v1/stop/<stop code>/upcoming_stoptimes</code></p>
<p>This will give a set of upcoming departures at a particular AMT stop (represented by its code). Example:</p>
<p><a href="http://amt.wrla.ch/blog/api/v1/stop/11260/upcoming_stoptimes">http://amt.wrla.ch/blog/api/v1/stop/11260/upcoming_stoptimes</a></p>
<p><code>/api/v1/place/<lat,lng>/upcoming_stoptimes?distance=<distance in meters></code></p>
<p>This will give a set of AMT stops within range of that endpoint, along with upcoming departures. Example:</p>
<p><a href="http://amt.wrla.ch/blog/api/v1/place/45.49640,%20-73.57567/upcoming_stoptimes?distance=1000">http://amt.wrla.ch/blog/api/v1/place/45.49640,%20-73.57567/upcoming_stoptimes?distance=1000</a></p>