OSMDroid Offline map with zip from custom server - android

I'm having a really hard time to get OSMDroid working with our custom tile server. I'm getting our tiles in a zip file which has the following structure:
ZoomLevel/Y/X
I've tried unzipping the zip to the osmdroid/tiles folder and the osmdroid/tiles/Mapnik folder but none of them seem work. I think I need to use the FileBasedTileSource but I don't know what to put in the aName and URL part of the method.
I'm trying to download specific areas as a zip file for use in offline situations, which on Google Maps works perfectly but I want to try out OSMDroid and see of the performance is better.
Can anyone give me some pointers on how to get this working?

Zip archives for osmdroid must have the following structure
{Source}/Z/X/Y.{extension}
Then tell osmdroid to use a tile source whose name matches exactly {Source}. Everything should be automatic.
Also, consider using sqlite database, they are generally faster

Related

OSMdroid custom offline xyzTiles?

Suppose you made a map in QGIS then used the tool "Generate XYZ Tiles" to create a directory or MBTiles file of XYZ Map Tiles. Is it possible to display that on an Android phone using OSMdroid?
If it isn't, is there another way?
Not sure about osmdroid, but it looks it's possible. For sure you can use tiles in OSMAnd (in a bit weird way, I have to admit, as overlay). OruxMaps supports tiles as well. You can check MOBAC (https://sourceforge.net/projects/mobac/) for possible outputs / programs which accepts the tiles.
For mbtiles with mobac, please see: https://gis.stackexchange.com/questions/294022/open-a-local-mbtiles-map-in-mobile-atlas-creator-mobac

Android API guides (with figures) for offline use

I'm looking for a possibility to browse the android API guides offline (with figures). I read several questions about this here (ex. 1, 2, 3...) and tried to get offline docs from the sdk folder or using a direct link. The problem with the actual version (23_r01) is that the images are often not displayed. For example in the page sdk/docs/design/index.html the image hero-material-design.png could not be displayed because of a bad src tag.
What I've tried:
Using the docs from the SDK folder
Direct download from https://dl-ssl.google.com/android/repository/docs-23_r01.zip
Saving the files using HTTrack (I'm getting errors here..)
What I would like to achive:
Download a correct version of the docs
OR "Repair" all the broken image paths in the html files
I would appreciate any help.
If thats still interested to you, just edit \docs\design\index.html, add .. before /design (it means the parent folder, one dot means the current), like that:
<img class="dac-hero-image" src="../design/media/hero-material-design.png">

How to use map.osm xml file in osmdroid instead of default online map

I have received a customized osm file (map.osm) from my customer to integrate Android project, but I don't know how to use that file, usually I'm using
mapView.setTileSource(TileSourceFactory.MAPNIK);
So, how I can use the map.osm file my android project.
Sorry but AFAIK it doesn't work like that. A Tilesource is a rendered raster map of geodata. Thus you need to render the data first in a local renderer, for example Maperiative or TileMill. They can create a tile folder structure output, that can be used by OSMdroid instead of the official tile sources: http://code.google.com/p/osmdroid/wiki/HowToUsePackager

Not displaying tiles in MOBAC with custom Maperitive tiles source

I need to generate a .sqlitedb map file for an Android app containing the map of a small city, I tried using Mobile Atlas Creator 1.9.14 by itself, but it only displays red crosses, no tiles(I use a proxy with authentication, and i configured it on the settings/network tab), I don't know what to do there. I then heard about Maperitive and I downloaded a .osm.pbf file from GeoFabrik to use as source, generated a Tiles folder i needed and followed this instructions to use it on MOBAC as custom source.
It does nothing at all, I still get the same red crosses everywhere, but everyone else seems to have it working just fine. What am I doing wrong?
Had the same problem, the template file from MOBAC has a lot of comments. After removing them it worked! My xml file is now very simple, even the <sourceType> seems not to be necessary. Here it is:
<localTileFiles><name>Maperitive Tiles</name><sourceFolder>/ed/map_composer/Maperitive/Tiles</sourceFolder><backgroundColor>#00000000</backgroundColor></localTileFiles>

working with osmdroid offline zip files (tiles)

I am working with osmdroid map viewer in offline mode. I have downloaded tiles with Mobile Atlas creator with osmdroid zip format and everything is ok. I want to know that is it possible to have more than one zip file? I just want 2 or 3 different locations that are far away from each other.
any help?
Yes, you can have more than one zip file in the folder. I have 3 files corresponding to different areas on my device. They all give me a map display when offline.
I was thinking that there is always one zip file for one layer - like mapinik, osmarender etc.
But... I looked into the code and it seems that you might be able to do so.
Take a look inside of zip file and if there is structure like: mapinik/zoomLevel/x/y - you should be able to add another file with same structure which should work.
I see that the code is looking inside all archive files for tile path. Im just not sure what "all archive files" meens and I have no time to investigate or test this :)
Hope that helped a little bit.
OutOfMemory exception is because heapsize is full. Most/all of Android phones have small heapsize (from 16 to 48mb). There should be also a workaround - to export data into SQLite instead of ZIP, atlas creator can also do that.
I havent seen OSMdroid code for a while but Im pretty sure he can also read this kind of stuff and you will not have a OutOfMemory problem then. One thing about SQLite is 2gb limit but it's still not bad.

Categories

Resources