Osmdroid:如何创建并从我自己的位图(砖)加载地图? [英] Osmdroid: How I can create and load a map from my own bitmaps(tiles)?

查看:226
本文介绍了Osmdroid:如何创建并从我自己的位图(砖)加载地图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始使用Osmdroid,我想用这种技术用于显示有关的F1赛道地图。我有一个大的画面,我可以砍它把它分成更小的砖。

I am starting to use Osmdroid and I would like to use this technology for showing a map about an F1 circuit. I have a big picture and I can cut it up to divide it into smaller tiles.

我可以修改osmdroid库,这些图片的上传?

Can I modify the osmdroid library for the upload of these pictures?

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

I would like to save these bitmaps (tiles) in my assets folder.

我是pretty的丢失如何做到这一点。

I am pretty lost on how to do this.

我使用这种方式,因为Android的,通常情况下,给出了一个内存错误,当我试图显示这个完整的全尺寸图片。如果我只显示图像的某些瓷砖(取决于变焦)也许我的应用程序将更好地工作?

I am using this way because android, normally, gives a memory error when I try show this complete full-size picture. If I only show some tiles of the image (depends of the zoom) maybe my app would work better?

在此先感谢!

推荐答案

Osmdroid使用系统中的世界地图分割成块。瓷砖通常具有相同的像素尺寸,这意味着需要使用多个瓦块更大的缩放级别为覆盖全球。每个瓦片有其坐标(x,y)和在其设计中使用的缩放级别。

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.

有可能使用各种自定义瓷砖源osmdroid。看看<一href="http://$c$c.google.com/p/osmdroid/source/browse/trunk/osmdroid-android/src/org/osmdroid/tileprovider/tilesource/TileSourceFactory.java"相对=nofollow>这个类osmdroid - 它创造了一些瓦来源的实例。您可以使用相同的机制自己瓷砖的来源。然而,这一切都将使用这些x,y坐标我上面介绍的世界。 Osmdroid会问你的瓷砖源,例如瓷砖10,10在缩放级别10,如果你可以创建你的地图瓦片工作这一坐标系统,然后它会奏效。但是,它可能很难做到这一点的自定义地图,如F1赛道。

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.

我也有兴趣在此,可能会尝试使用osmdroid平铺机制,在不久的将来显示一些大的图像。如果在此成功,请让我知道:)

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:).

这篇关于Osmdroid:如何创建并从我自己的位图(砖)加载地图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆