6

我开始使用 Osmdroid,我想使用这项技术来显示有关 F1 赛道的地图。我有一张大图,我可以把它切成小块。

我可以修改 osmdroid 库来上传这些图片吗?

我想将这些位图(图块)保存在我的资产文件夹中。

我对如何做到这一点非常迷茫。

我之所以使用这种方式,是因为当我尝试显示这张完整的全尺寸图片时,android 通常会出现内存错误。如果我只显示图像的一些图块(取决于缩放),也许我的应用程序会更好地工作?

提前致谢!

4

2 回答 2

2

Osmdroid uses a system in which world map is divided into tiles. Tiles usually have the same pixel size which means that the bigger zoom level you use the more tiles are needed to "cover the world". Each tile has its coordinates (x,y) and a zoom level in which it is designed to be used.

It is possible to use various custom tile sources in osmdroid. Take a look at this class in osmdroid - it creates instances of some tile sources. You can create your own tile sources using the same mechanism. However, all this uses these x,y coordinates of the world I described above. Osmdroid will ask your tile source for example for tile 10,10 in zoom level 10. If you are able to create tiles of your map to work with this coordinates system then it will work. However, it may be hard to do this for custom maps such as F1 circuits.

I am also interested in this and probably will try to use tiling mechanism of osmdroid to display some big images in the near future. If you succeed in this please let me know:).

于 2011-11-20T15:44:42.127 回答
1

我认为这里有两个问题:

  1. 如何从位图文件创建 osmdroid 格式的地图图块。
  2. 如何将它们加载到 osmdroid

对于问题 1,您可以使用工具来创建图块。

  • http://www.maptiler.org/ 可用于从位图中提供位图及其边界坐标的位图创建图块。
  • http://mobac.sourceforge.net/ 从在线地图创建地图集,它可以创建 osmdroid zip 地图集。不确定您是否可以使用它来创建您的 osmdroid zip 格式。
  • 如果 Mobile Atlas creator 没有帮助,如果您的源位图不是太大,您可以手动创建 zip。

对于问题 2:

于 2013-02-12T13:26:48.800 回答