How to use the GTFS channel?

I want to use the GTFS channel in Google Maps, but I donโ€™t know how to do it. I want to display the buses available from the route. Just so you know, I plan to implement the Google map that I create in a Visual C # application.

+4
source share
1 answer

This is a very general question, so my answer will certainly be general. If you can provide more detailed information about what you are trying to accomplish, I will try to offer more specific help.

High-level steps for working with the GTFS channel:

  • Parse the data. From the URL of the GTFS channel, you will get a ZIP file containing a set of CSV files. The format of these files is specified in the Google GTFS link , and most languages โ€‹โ€‹already have a library for CSV analysis that can be used to read into data. In addition, GTFS parsing libraries are available for some languages โ€‹โ€‹that will return data from these files as objects; it looks like C # is available there, gtfsengine , you can check.

  • Download data. You will need to store data somewhere, at least temporarily, to work with it. It might just be a data structure in memory (especially if you wrote your own parsing code), but since large pipes may take some time to read, you probably want to look at using a relational database or some other type of storage can serialize to disk. In the application I'm developing, a separate process parses and loads GTFS data into a relational database in one go.

  • Request data. Obviously, how you do this will depend on the method you use to store the data and the purpose of your application. If you use a relational database, you will usually have one table for each GTFS object (or CSV file) on which you can create indexes and with which you can execute SQL queries. If you work with objects in memory, you can also build a hash table index in memory and query to find the data you need.

+4
source

Source: https://habr.com/ru/post/1486200/


All Articles