Vinod Louis
Vinod Louis

Reputation: 4876

How to consume GTFS feed in Google Map v3 using Javascript?

I'm first time trying to use GTFS(General Transit Feed Specification) with Google Maps as per the Google developers page i have understood the concept of .txt files which are used as feed and for making a demo i downloaded a transit zip files from Google developers page. but I'm not getting how to use those transit files to show information on map. I tried to search tutorial for the same but could not find anything useful. Do i need to parse all those files to show in map or there is something different implementation.

I'm confused.

Please bear me with my lack of knowledge regarding GTFS.

Upvotes: 3

Views: 3870

Answers (2)

Brendan Nee
Brendan Nee

Reputation: 5353

If you want to display stops and routes on a map, you can use gtfs-to-geojson to convert GTFS to GeoJSON that can be loaded onto a Google Map or Mapbox.

Install gtfs-to-geojson:

npm install gtfs-to-geojson -g

Setup a config.json file, then run:

gtfs-to-geojson --configPath /path/to/your/config.json

The tool will output a folder of GeoJSON files.

Upvotes: 3

David Pritchard
David Pritchard

Reputation: 318

As far as I know, GTFS is not yet "plug and play" ready - there's no simple way to just load up a GTFS dataset and work with it or query it on Google Maps, using either Google's web interface or their Javascript libraries.

Getting this working requires:

  1. Setting up a (SQL) database and importing the GTFS dataset into that database.
  2. Setting up a query system to get the information you want out of the SQL database (e.g., a web front-end that queries the database backend).

Feel free to look at some examples from around the web:

Upvotes: 1

Related Questions