开发者

Download all tiles in Bounding Box using Cloudmade Ruby API

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 h开发者_JAVA技巧ow 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!


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜