Osmdroid: How can I create and load a map from my own bitmap images (tiles)?

I am starting to use Osmdroid, and I would like to use this technology to display a map about the F1 circuit. I have a big picture, and I can cut it to divide it into smaller tiles.

Can I change the osmdroid library to download these images?

I would like to save these bitmap images (tiles) in a folder with my resources.

I am pretty lost how to do this.

I use this method because the android, as a rule, gives a memory error when I try to show this full full-size picture. If I show only some fragments of the image (depends on the increase), maybe my application will work better?

Thanks in advance!

+6
source share
2 answers

Osmdroid uses a system in which a world map is divided into tiles. Tiles usually have the same pixel size, which means that to increase the reach of the world requires a higher level of scaling, which you use more tiles. Each tile has its own coordinates (x, y) and the zoom level at which it is intended for use.

In osmdroid, you can use various custom tile sources. 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 described above. Osmdroid will ask your tile source, for example, for a tile of 10.10 in zoom level 10. If you can create tiles of your map to work with this coordinate system, then it will work. However, this can be difficult to do for custom maps, such as F1 circuits.

I'm also interested in this and will probably try to use the osmdroid split mechanism to display some large images in the near future. If you succeed, please let me know :).

+2
source

I think there are two questions here:

  • How to create osmdroid map tiles from a raster file.
  • How to upload them to osmdroid.

In question 1, you can use the tool to create your snippets.

  • http://www.maptiler.org/ Can be used to create fragments from a bitmap that gives borders in your bitmap and its coordinates.
  • http://mobac.sourceforge.net/ Creates an atlas from online maps, it can create an osmdroid zip atlas. Not sure if you could use it to create your osmdroid zip format.
  • If the creator of Mobile Atlas does not help, perhaps you can create a zip manually if the source bitmap is not too large.

For question 2:

+1
source

Source: https://habr.com/ru/post/894079/


All Articles