{"id":18057,"date":"2018-05-25T16:13:22","date_gmt":"2018-05-25T14:13:22","guid":{"rendered":"https:\/\/www.ingartek.com\/gtfs-from-a-technological-point-of-view\/"},"modified":"2023-02-23T22:25:48","modified_gmt":"2023-02-23T21:25:48","slug":"gtfs-from-a-technological-point-of-view","status":"publish","type":"post","link":"https:\/\/www.ingartek.com\/en\/gtfs-from-a-technological-point-of-view\/","title":{"rendered":"GTFS from a technological point of view"},"content":{"rendered":"<p>GTFS derives from the English initials of General Transit Feed Specification, known in Spanish as <em>Especificaci\u00f3n General de Feeds de Transporte P\u00fablico<\/em>. The objective is to develop a common format for public transport timetables and geographic information relating to them.<\/p>\n<p>Thanks to this standard, transport operators offer their travellers journey information.<\/p>\n<p><strong>A little history<\/strong><\/p>\n<p>The story goes that it all began at Google back in 2005. The employees at this company have a policy named \u201c20% time\u201d, which allows them to devote 20% of their time to reading about all kinds of things and thinking about ideas and promoting experiments. Chris Harrelson wanted to incorporate travel information into Google Maps when he met Tim and Bibiana McHugh, a couple who worked at the transport company TriMet, in Portland, Oregon. At that time, the most popular map services offered travel instructions as you drove, while travel information in unfamiliar cities was still a utopia. Then, the Google employee and the couple from TriMet began to exchange information, timetable information in CSV format.<\/p>\n<p>This resulted in Google Transit Trip Planner, and Portland was the first city included in the project with information about its metro system. Soon, more cities in the United States were included and its gradually spread around the world, as its popularity grew.<\/p>\n<p><strong>Overview of a GTFS feed<\/strong><\/p>\n<p>A GTFS file is a compressed file in ZIP format that contains several text files in CSV format. Normally, this is known as a GTFS feed.<\/p>\n<p>Each text file that comprises the feed shapes a particular aspect of travel information, which we are now going to list below.<\/p>\n<ul>\n<li><strong>agency.txt<\/strong><\/li>\n<\/ul>\n<p>Obligatory. It defines one or several public transport companies that provide the data for this feed.<\/p>\n<ul>\n<li><strong>stops.txt<\/strong><\/li>\n<\/ul>\n<p>Obligatory. It specifies the stops that services are provided to.<\/p>\n<ul>\n<li><strong>routes.txt<\/strong><\/li>\n<\/ul>\n<p>Obligatory. It defines the public transport routes. A route is a series of trips that is displayed to passengers as a single service.<\/p>\n<ul>\n<li><strong>trips.txt<\/strong><\/li>\n<\/ul>\n<p>Obligatory. These are the trips for each route. A trip is a sequence of two or more stops that take place at a particular time.<\/p>\n<ul>\n<li><strong>stop_times.txt<\/strong><\/li>\n<\/ul>\n<p>Obligatory. Within a trip, it specifies the times at which a vehicle arrives at a stop and departs from it.<\/p>\n<ul>\n<li><strong>calendar.txt<\/strong><\/li>\n<\/ul>\n<p>Obligatory. It defines service patterns that the company operates in, for example every day of the week, only at weekends or Monday to Wednesday.<\/p>\n<ul>\n<li><strong>calendar_dates.txt<\/strong><\/li>\n<\/ul>\n<p>Optional. It indicates the exceptions to the service of calendar.txt, although it can replace it if it has all the service dates.<\/p>\n<ul>\n<li><strong>fare_attributes.txt<\/strong><\/li>\n<\/ul>\n<p>Optional. Here is where the route fares are defined.<\/p>\n<ul>\n<li><strong>fare_rules.txt<\/strong><\/li>\n<\/ul>\n<p>Optional. These are the rules that apply to the information on fares corresponding to routes.<\/p>\n<ul>\n<li><strong>shapes.txt<\/strong><\/li>\n<\/ul>\n<p>Optional. Here the rules are defined for the layout of the lines on a map. If this file is not defined, the routes would be drawn as straight lines.<\/p>\n<ul>\n<li><strong>frequencies.txt<\/strong><\/li>\n<\/ul>\n<p>Optional. Defines the time between trips for routes whose service frequency is variable.<\/p>\n<ul>\n<li><strong>transfers.txt<\/strong><\/li>\n<\/ul>\n<p>Optional. This file specifies the rules for establishing connections in the transfer points between routes.<\/p>\n<ul>\n<li><strong>feed_info.txt<\/strong><\/li>\n<\/ul>\n<p>Optional. Here, information is included about the feed itself, that is to say, it includes information about the editor, the version, and the expiration of the feed.<\/p>\n<p><strong>Generation of feeds<\/strong><\/p>\n<p>Normally, the data source is a Operation Support System or OSS, that it is necessary to connect to and get informed about in order to find what is needed for the feed. In these cases, the difficult work consists of exploring the different databases in search of the table that provides the necessary data. In reality, this type of connection is none other than a database where you can choose precisely what is needed.<\/p>\n<p>However, the objective is always the same. To begin with, there is a search for the operators that comprise the feed to be created, which are normally unique. Also, there is an attempt to find the most static data, such as its stops, routes and calendars. From there on, the most difficult tasks are looking for the trips for each route and generating the times per stop. Generally speaking, the routes are not shown in a straight line, the shapes.txt file is provided so that the lines drawn on maps reflect the trips carried out along the appropriate routes (roads, train tracks or metro\u2026). Unfortunately, information such as fares, frequencies and transfers is rarely included.<\/p>\n<p>It is desirable to provide accurate information to the GTFS standard, so that its processing is quick and does not require a long time to be created, with information left in repositories such as FTP, Amazon S3, etc.<\/p>\n<p>Likewise, apart from OSSs and the latter, there are many data sources that can be processed on Web Services, whether SOAP or Rest.<\/p>\n<p><strong>Technologies at our service<\/strong><\/p>\n<p>At Ingartek we commit to and promote the use of Free Software. Using Java technologies, our developments for handling GTFS feeds are built using Spring Boot framework and the tools created by Conveyal, OneBusAway and OpenTripPlanner, as well as those that Google provides.<\/p>\n<p><strong>Validation of feeds<\/strong><\/p>\n<p>Having generated a GTFS feed, it is necessary to check that it does not contain any type of errors. For that purpose, Google created FeedValidator, a tool that analyses GTFS feeds and generates a web report showing errors and warnings or recommendations.<\/p>\n<p>This tool requires knowledge of the use of terminals\/consoles and command lines, which refer to the GTFS feeds and, with different personalization parameters, generate the validations.<\/p>\n<p>Having carried out this initial check, it is necessary to upload the GTFS feeds to Google\u00b4s Partner Dash platform. There, a second and last validation is carried out, before the information is subsequently made available to the public.<\/p>\n<p><strong>Conclusions<\/strong><\/p>\n<p>Ultimately, the GTFS standard requires specific knowledge for its implementation, whether technical knowledge regarding new technologies or knowledge inherent to transport. Also, it has to go through very strict filters that correspond to standards defined by Google, which demands mastery of a series of tools.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>GTFS derives from the English initials of General Transit Feed Specification, known in Spanish as Especificaci\u00f3n General de Feeds de Transporte P\u00fablico. The objective is to develop a common format for public transport timetables and geographic information relating to them&#8230;.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"content-type":"","footnotes":""},"categories":[202,1460,1443],"tags":[],"class_list":["post-18057","post","type-post","status-publish","format-standard","hentry","category-knowledge-blog","category-gtfsuite-product","category-technical-assistance-and-technological-development"],"_links":{"self":[{"href":"https:\/\/www.ingartek.com\/en\/wp-json\/wp\/v2\/posts\/18057","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ingartek.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ingartek.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ingartek.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ingartek.com\/en\/wp-json\/wp\/v2\/comments?post=18057"}],"version-history":[{"count":0,"href":"https:\/\/www.ingartek.com\/en\/wp-json\/wp\/v2\/posts\/18057\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.ingartek.com\/en\/wp-json\/wp\/v2\/media?parent=18057"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ingartek.com\/en\/wp-json\/wp\/v2\/categories?post=18057"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ingartek.com\/en\/wp-json\/wp\/v2\/tags?post=18057"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}