使用 Cloudmade Ruby API 下载 Bounding Box 中的所有图块

发布于 2024-10-20 10:28:01 字数 254 浏览 8 评论 0原文

任何人都可以提供一个在边界框内下载缩放 10-18 之间的所有图块的示例吗?

我正在尝试使用 Ruby API 但我似乎无法理解其中的任何一个,我可以看到如何下载单个图块,如何制作边界框,但不知道如何使用边界框下载其中的所有图块,以便在我的 iPhone 应用程序中使用离线地图。谢谢!

Can anybody supply an example of downloading all tiles between say zoom 10-18, inside a bounding box,

I'm trying to do this using the Ruby API but i can't seem to make sense of any of it, i can see how to download a single tile, how to make a boundingbox, but not how to use a bounding box to download all tiles inside it to use offline maps in my iPhone app. Thanks!

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

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

发布评论

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

评论(2

早茶月光 2024-10-27 10:28:01

我将这个 perl 脚本 转换为 Ruby,效果非常好!

I converted this perl script to Ruby and it works great!

原谅过去的我 2024-10-27 10:28:01

查看 TileService 类。它有方法#get_xy_tile、#latlon2tilenums。这就是你所需要的。
使用 #latlon2tilenums 将 (lat1, lon1), (lat2, lon2) 转换为 (x1, y1), (x2, y2)。
x(s) 和 y(s) 是整数。
现在您必须从 min(x1, x2) 到 max(x1, x2) 进行简单循环,对 y(s) 执行相同的操作,仅此而已。

如果你编写了这个函数,你可以将其发送给 API 的作者,即我;),然后我们将其提交到主干。

Look into TileService class. It has methods #get_xy_tile, #latlon2tilenums. That's all you need.
Convert (lat1, lon1), (lat2, lon2) to (x1, y1), (x2, y2) with #latlon2tilenums.
x(s) and y(s) are integers.
Now you have to simple loop from min(x1, x2) to max(x1, x2), do the same for y(s) and that's it.

If you write this function you can send it to authors of API, i.e. me ;), and we commit it to the trunk.

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