Look here:
http://www.chartbundle.com/charts/
Scroll to the section named 'Mobile Atlas Creator(MOBAC)'.
You can use MOBAC to download the ChartBundle tiles on a computer and create an offline tile archive.
You can then use this offline tile archive with OSMDroid.
Look at this forum search for more info on using MOBAC:
https://www.b4x.com/android/forum/pages/results/?query=mobac&page=1&prefix=0
An offline tile archive has a few disadvantages:
- Covering anything but a small area will result in a large (or very large) tile archive.
Including a large tile archive with your compiled .apk is generally impractical.
So you then need to host the tile archive online and download it to your b4a application once the application is installed.
- If the Chartbundle data changes then your offline tiles will be out of date and display old and/or invalid data.
You need to monitor the Chartbundle data and be sure to update your offline tile archive whenever the Chartbundle data is changed.
The Chartbundle page (linked to above) offers for download various .xml files that can be used to configure MOBAC.
Look at this one, '
Sectional Charts':
Code:
<?xml version="1.0" encoding="UTF-8"?>
<customMapSource>
<name>Chartbundle US Sectional Charts</name>
<minZoom>4</minZoom>
<maxZoom>13</maxZoom>
<tileType>png</tileType>
<tileUpdate>None</tileUpdate>
<url>http://wms.chartbundle.com/tms/v1.0/sec/{$z}/{$x}/{$y}.png?type=google</url>
<backgroundColor>#000000</backgroundColor>
</customMapSource>
This xml tells MOBAC all it needs to know in order for it to connect to and download tiles from this tile server.
Version 4.1 of my b4a OSMDroid library has an object named
OSMDroid_UrlTileSource that's used to display tiles from an online tile server.
The OSMDroid_UrlTileSource object's Initialize method is documented:
So i'm thinking that you might be able to use OSMDroid version 4.1 and it's UrlTileSource.
Get the urls of the tile servers from the various MOBAC xml configuration files and try those urls with the UrlTileSource.
With a bit of luck it'll work perfectly and display tiles on the map with no need for an offline tile archive.
Version 4.1 of OSMDroid was never properly uploaded to the forum, it's available for download from my server here:
http://b4a.martinpearman.co.uk/osmdroid/
That link should show some version 4.1 examples available to download and one example is
OSMDroid_4.1_UrlTileSource.zip which you should find useful.
Version 4.1 also has better support for map rotation - i'm not sure if the problem with blank areas appearing was fixed or not.