使用 Cloudmade Ruby API 下载 Bounding Box 中的所有图块
任何人都可以提供一个在边界框内下载缩放 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我将这个 perl 脚本 转换为 Ruby,效果非常好!
I converted this perl script to Ruby and it works great!
查看 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.