MTA Subway data (among other data) is formatted in GTFS-realtime. In order to convert the protobuf into a string representation I must run it through some Google protobuf tools using gtfs-realtime.proto. The only problem is that, as can be seen here, the gtfs-realtime-bindings are available only for
- NET
- Java
- JavaScript / Node.js
- PHP
- Python
- Ruby
- Golang
Additionally,
We don't provide generated code for C++, use the official protoc compiler for that (from here or here)
None of these are Swift or Objective C. While there is an open issue/request for a Swift/Objective C version from 2016, I was wondering what I can do currently in order to do this. As of now, the only viable solution I see is to have a server parse the data and then GET the parsed data (JSON encoded?) from that server instead of directly from the MTA.
Here is the Google page for protocol buffers. I am not sure, but is there some way to use what is there to read the GTFS-realtime data.
Is that the best path forward? Are there any other possibilities?
As noted by Tony Laudig, having your app directly communicate with the MTA is a breach of their terms and conditions which you almost definitely would have had to agree to in order to get an api key.
Breaking terms and conditions is generally a pretty bad idea. In the case of this API, it seems like your key will be revoked.
Thus, I would not suggest using the library in Tony’s answer. Instead, do what you proposed:
Any of the languages you listed will do the job, it’s just a matter of which you’re most comfortable with.