我开始使用 Osmdroid,我想使用这项技术来显示有关 F1 赛道的地图。我有一张大图,我可以把它切成小块。
我可以修改 osmdroid 库来上传这些图片吗?
我想将这些位图(图块)保存在我的资产文件夹中。
我对如何做到这一点非常迷茫。
我之所以使用这种方式,是因为当我尝试显示这张完整的全尺寸图片时,android 通常会出现内存错误。如果我只显示图像的一些图块(取决于缩放),也许我的应用程序会更好地工作?
提前致谢!
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:).
我认为这里有两个问题:
对于问题 1,您可以使用工具来创建图块。
对于问题 2: