OneBusAway / onebusaway-gtfs-modules

A Java-based library for reading, writing, and transforming public transit data in the GTFS format, including database support.

Home Page:https://github.com/OneBusAway/onebusaway-gtfs-modules/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prevent extra columns from exporting

russellhoff opened this issue · comments

When I export GTFS files, there are some of them which include extra columns. For example, agency.txt file contains agency_email column, which isn't originally regarded as official (see [this]).

When I execute feedvalidator, I get some warnings regarding this matter, which I want them to abolish:

Unrecognized Column

Unrecognized column agency_email in file agency.txt. This might be a misspelled column name (capitalization matters!). Or it could be extra information (such as a proposed feed extension) that the validator doesn't know about yet. Extra information is fine; this warning is here to catch misspelled optional column names.
in line 1 of agency.txt
agency_id agency_name agency_url agency_timezone agency_lang agency_phone agency_fare_url agency_email

Unrecognized column stop_direction in file stops.txt. This might be a misspelled column name (capitalization matters!). Or it could be extra information (such as a proposed feed extension) that the validator doesn't know about yet. Extra information is fine; this warning is here to catch misspelled optional column names.
in line 1 of stops.txt
stop_id stop_name stop_lat stop_lon stop_code stop_desc zone_id stop_url location_type parent_station wheelchair_boarding stop_direction stop_timezone vehicle_type platform_code

Unrecognized column vehicle_type in file stops.txt. This might be a misspelled column name (capitalization matters!). Or it could be extra information (such as a proposed feed extension) that the validator doesn't know about yet. Extra information is fine; this warning is here to catch misspelled optional column names.
in line 1 of stops.txt
stop_id stop_name stop_lat stop_lon stop_code stop_desc zone_id stop_url location_type parent_station wheelchair_boarding stop_direction stop_timezone vehicle_type platform_code

Unrecognized column platform_code in file stops.txt. This might be a misspelled column name (capitalization matters!). Or it could be extra information (such as a proposed feed extension) that the validator doesn't know about yet. Extra information is fine; this warning is here to catch misspelled optional column names.
in line 1 of stops.txt
stop_id stop_name stop_lat stop_lon stop_code stop_desc zone_id stop_url location_type parent_station wheelchair_boarding stop_direction stop_timezone vehicle_type platform_code

Unrecognized column route_bikes_allowed in file routes.txt. This might be a misspelled column name (capitalization matters!). Or it could be extra information (such as a proposed feed extension) that the validator doesn't know about yet. Extra information is fine; this warning is here to catch misspelled optional column names.
in line 1 of routes.txt
agency_id route_id route_short_name route_long_name route_type route_desc route_url route_color route_text_color route_bikes_allowed bikes_allowed route_sort_order

and 6 more of this type.

How could I be able to prevent it?

It comes to my mind two ways:

  1. Modifying (or extending) java objects (such as Agency) and removing the desired columns. This would imply forking the project, and this is the last thing I want to do, which leads to 2.
  2. Perhaps it can be done somehow. I've seen that within Agency.java there are some attributes marked with an "@CsvField(optional = true)" annotation. Would I be able to remove those columns with GtfsWriter?

Thanks for your help!

(https://developers.google.com/transit/gtfs/reference?hl=es#agencytxt)

I've solved the issue. There is a method called excludeOptionalAndMissingFields() within GtfsWriter.