如何找到球面墨卡托点
我正在使用 Open Street Maps 在 HTML5 应用程序中显示地图。
它对地图图块使用这样的 URL,
http://b.tile.openstreetmap.org/{Z}/{X}/{Y}.png
如果我选择一个区域,例如新西兰奥克兰,我如何计算出覆盖奥克兰的所有 Z、X、Y 值?我希望编写一个脚本来抓取所有这些图像并将它们缓存在 HTML5 数据库中。
I am using Open Street Maps to show a map in my HTML5 application.
It uses a URL like this for the map tiles,
http://b.tile.openstreetmap.org/{Z}/{X}/{Y}.png
If I chose an area, say Auckland, New Zealand, how could I work out all of the values of Z, X, Y that would cover Auckland? I would be looking to write a script to go and grab all those images and cache them in an HTML5 database.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,请查看有关批量下载的图块使用政策部分。其次,这种缓存可以使用 TileStache 轻松完成:配置缓存以从特定源渲染或获取图块,然后运行
tilestache-seed.py
,传入边界框(以 WGS84 坐标表示)和所需的缩放级别,最终您应该得到所有需要的图块。First of all, take a look at the tile usage policy section about bulk download. Secondly, this sort of caching is easily done using TileStache: configure a cache to render or fetch tiles from a certain source, then run
tilestache-seed.py
, passing in the bounding box (in WGS84 coordinates) and desired zoom levels, and you should end up with all needed tiles.