Protobuf和Translink

发布于 2025-02-02 11:50:38 字数 80 浏览 2 评论 0 原文

我发现了我想使用的GTFS数据,但是IDK如何设置Protobuf(最好是在Python中)读取数据。任何帮助将不胜感激。谢谢。

I've found this GTFS data that I want to use, but IDK how to set up protobuf (preferably in Python) to read the data. Any help would be greatly appreciated. Thanks.

https://gtfsrt.api.translink.com.au/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

萧瑟寒风 2025-02-09 11:50:38

首先,您需要从 github

在每个版本的下载部分中,您可以在zip软件包中找到预构建的二进制文件:protoc- $ version- $ platform.zip

second,compile gtfs-realtime.proto 使用以下命令:

protoc -i =。 -python_out =。 ./gtfs-realtime.proto

这将在当前目录中查找 gtfs-realtime.proto ,并生成 .py> .py 文件>您可以在您的中导入的文件项目。有关更多信息,请查看 this教程
那是针对Protobuf的部分。

我没有GTF的经验,但是我想这个样本可能会帮助您。

First, you need to download the protocol compiler from here. According to Protobuf guide on GitHub:

In the downloads section of each release, you can find pre-built binaries in zip packages: protoc-$VERSION-$PLATFORM.zip

Second, compile gtfs-realtime.proto using following command:

protoc -I=. --python_out=. ./gtfs-realtime.proto

This will look for gtfs-realtime.proto in the current directory and generates a .py file which you can import in your project. For more information, check out this tutorial.
That's for the Protobuf part.

I don't have experience with GTFS, but I guess this sample may help you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文