Open AAverin opened 9 years ago
It's probably not that simple as one needs to be able to seek quickly within the file. I would suggest to copy the map asset to a temporary file instead: http://stackoverflow.com/questions/9335379/randomaccessfile-in-android-raw-resource-file
That is what I do now. But the idea is that we provide some initial world map with the application, and it's quite large. It takes ~10 seconds to copy the map to sdcard from assets and load it up. I hoped to be able to load the file as it is from the assets stream so it would speed up initial startup process.
Depending on the performance of AssetInputStream.seek() it should be feasable to use the asset directly. In this case one could abstract the use of RandomAccessFile as, say, 'MapFile' and implement it also for assets. It seems the are only a handful of places in MapDatabase and ReadBuffer which need to be modified. To me the mapsforge tilesource is legacy code and I would rather look into supporting the osmand or libosmscout format for offline maps.
As far as I know, mapsforge is the only offline maps format supported by library at the moment, right? So we kinda have to stick with it. I also don't like the performance of displaying many maps in the mapsforge format - when I browse the map it becomes slow very quickly. Are there any exact plans on supporting other formats?
Any updates on support for offline maps?
Currently MapFileTileSource requires an absolute path to the tiles file. Android Assets can't really provide an absolute path, but can give you a stream to an asset file. Is there an option to create mapsfore tile directly from the stream?