Osmdroid: How I can create and load a map from my own bitmaps(tiles)?
Asked Answered
P

2

6

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.

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

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

I am pretty lost on how to do this.

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?

Thanks in advance!

Poult answered 17/11, 2011 at 16:1 Comment(0)
R
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:).

Readability answered 20/11, 2011 at 15:44 Comment(1)
Ok, I am improving but I have a lot problems with this subject: Now, I can load my custom bitmaps and I can see the map. Only I am using one zoom level. My problem now is how I know in with geo-coordenates is each one of the tiles that I am drawing. This task is driving me crazy! When I have something solid, I will post it. If someone has some suggestions, please, let me know.Poult
K
1

I think there's two questions here:

  1. How to create osmdroid format map tiles from a bitmap file.
  2. How to load them into osmdroid

For question 1 you can use a tool to create your tiles.

  • http://www.maptiler.org/ Can be used to create tiles from a bitmap giving in your bitmap and its boundaries coordinates.
  • http://mobac.sourceforge.net/ Creates Atlas from online maps, it can create osmdroid zip atlas. Not sure if you could use it to create your osmdroid zip format.
  • If Mobile Atlas creator doesn't help perhaps you can create the zip manually if your source bitmap is not too big.

For question 2:

Kazachok answered 12/2, 2013 at 13:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.