7

I am brand new to the General Transit Feed Specification (GTFS) stack and subway calculations and I'm working on a project where I need to tell a user what the best route / line to take based on their current location and the destination latitude and longitude.

I've done some googling and see some good ways to find the closest subway based on current location, but I'm at a loss as to what to do to get the path to the destination if let's say they have to take multiple lines to get to a destination.

Can some one give me some guidance and possible tutorials?

  • If you "see some good ways to find the closest subway based on current location" then perhaps you can include details of that so it is clear where you are up to and stuck. – PolyGeo Dec 14 '13 at 10:20
  • Thank you for responding PolyGeo. The API I found that I think can help is data.ny.gov/developers/docs/nyctransitsubwayentrance-and-exit. They have a way to provide lat and long coordinates to get the closest subway. I would use this to get where to start, but I'm not sure what I could use or what I can do to figure out the rest of the path to their destination. Like if they would need to get off one line to take another. That's really where I am stuck is what to do next. – gcoleman0828 Dec 15 '13 at 16:41
  • you should be careful with your method. Finding the closest subway then solving the route from the subway will not necessarily end with the best route. the carictural example is to have your destination 10 feet away from your origin and sennin your client to the subway. Ideally you should build a multimodal network. – radouxju Dec 21 '13 at 11:04
  • Thank you @radouxju... Are there any examples on how to go about making this kind of network for a subway matrix or is it something that isn't done much? Anything you would recommend I read on the subject to get more familiar with I am trying to accomplish? – gcoleman0828 Dec 21 '13 at 17:26
  • Have you seen this tool ? -transit.melindamorang.com/overview_AddGTFStoND.html – Geog Dec 26 '13 at 6:43
5

ESRI have a new tool that allow to add GTFS to a Network Dataset, display GTFS Route Shapes, edit GTFS Stop Locations, calculates transit/walking service areas for a specific time of day and day of the week, and more effective gadegets. There is also a blog avout this tool with samples to each procedure a lot of more links

3

You might want to look at OpenTripPlanner. There's an instance set up here that includes the MTA GTFS feeds. It was built with the transit index included, which can be queried via its API to find the nearest stops. The API can also be queried to plan trips.

An example query, to find stops near a point: http://opentrips.codeforphilly.org/opentripplanner-api-webapp/ws/transit/stopsNearPoint/?lat=40.749526&lon=-73.988231

There's a public AMI of the setup, if you're interested. The AMI is: ami-d9517ab0 "OpenTripPlanner Philly NJ NYC DE"

This link will go to launch an instance of it.

Notes in a Google doc, here: http://bit.ly/19aMdw1

2

I have a fully functional, open source , freely hosted, GTFS Editor here wayback machine saved link

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

  • Could you please add more details to your answer? Link only answers become defunct if the link fails. – Aaron Sep 12 '14 at 18:36
  • speaking off, it's dead now – albert May 19 '17 at 15:09
  • it can be made to live again. give me a call on mc_lester@yahoo.co.uk if you are still doing this. i added a reply at the bottom. – Mark Lester Oct 29 '17 at 12:33
1

Just some general thoughts:

You can load the vectors for streets and roads into PostgreSQL/PostGIS from OSM, Tiger, or whatever source you have (note that depending on the source there might be some topology issues to work out, a road could be broken into multiple line segments that don't technically connect in the data set, causing your map to send people around the long way).

Then use this: http://pgrouting.org/

Which is a PostgreSQL/PostGIS extension to locate the shortest path. It's already being used in NYC actually: http://www.ridethecity.com/

So that's where I would start. And the best part is that it's all open source, so you can experiment for free and scale up as you need to.

  • 1
    I don't see how this uses the GTFS data. – Devdatta Tengshe Feb 5 '14 at 11:58
1

Transitland maintains a feed registry for gtfs data, as well as datasets for each submitting transit agency/authority.
To get transit route information, simply search for the desired route's provider.
I'm in DC, so I searched for WMATA, which took me to WMATA's transit.land profile.
Each transit agency's profile has multiple datasets (Operator Service Area, Routes, Stops, and Scheduling) for consumption/use, each of which offer both JSON/GeoJSON downloads, as well as importing into Mapzen Mobility Explorer and geojson.io.

Other GTFS Routing Tools:
OSRM (Open Source Routing Machine) is a modern C++ routing engine for shortest paths in road networks.
routing.js is a JavaScript library providing GTFS in the browser.

0

Sorry I gave up on all this some time ago as I couldnt get anyone interested. I wanted to build a wikitimetabke for all those places (well over 90% of the global transit network) that arent and are not going to be any time soon on google. I have a stack of stuff, i.e a stack, including a proper leaflet integration to Backbone, not reading a geoJSON, (anyone can do that in a line obviously, this will redaw your polyline as stuff in the DB changes via websockets and mvc.

I am at mc_lester@yahoo.co.uk I am busy blowing a hole in all this blockchain bull' flying about right now, but if you want to do this, i.e get a proper and open GTFS editor working, please call and we can see if we can get it running again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.