The latest alpha version of MOBAC supports rendering tiles from a local MapsForge database.
http://mobac.sourceforge.net/forum/viewtopic.php?f=1&t=526
What does this mean?
MOBAC's support for MapsForge means you can forget about all of these limits and restrictions.
You will need:
Now start MOBAC and look in the (upper left) list of available Map Sources.
You should see your new 'Custom Mapsforge' Map Source.
Pan the map so that it shows an area covered by your MapsForge database and you'll see MOBAC is rendering and displaying tiles from your MapsForge database.
You can now create an offline tile archive using your new MapsForge Map Source.
Quick and simple with no limits and restrictions.
Now if you want MOBAC to render your tiles with a different style you can create a new custom 'Render Theme'.
Have a look here:
https://github.com/mapsforge/mapsforge/blob/master/docs/Rendertheme.md.
The current default MapsForge Render Theme can be found here:
https://github.com/mapsforge/mapsforge/tree/master/mapsforge-map/src/main/resources/osmarender
osmarender.xml defines exactly how your tiles are styled.
Creating a custom Render Theme can be as simple as changing the color of a feature such as a footpath.
Or you could spend time creating an entirely new Render Theme.
You can download the default MapsForge Render Theme and use it as a base for a new Render Theme.
Once you've created a new Render Theme you need to modify your MapsForge Map Source XML file, uncomment the 'xmlRenderTheme' element and set the path to your new Render Theme.
Restart MOBAC and you should now see your tiles are rendered using your new style.
MapsForge still has ongoing issues with tiles that contain both land and sea - the sea sometimes fails to render as blue.
A solution can be found here:
https://github.com/mapsforge/mapsforge-mapcreator
The MapCreator can be used to convert Open Street Map data into a MapsForge database using a technique which ensures that tiles that contain both land and sea are correctly rendered.
Martin.
http://mobac.sourceforge.net/forum/viewtopic.php?f=1&t=526
This allows MOBAC to render bitmap tiles on-the-fly using Mapsforge vector data files. Those vector data files can be downloaded pre-generated for a large number of regions world-wide. Alternatively you can convert OpenStreetMap data to mapsforge format on your own.
The map rendering of the vector data can be configured using xml base render themes.
What does this mean?
- If you use offline map tiles in your application you might have noticed that many tileservers are now blocking bulk download requests.
For example, Mapnik no longer allows you to use MOBAC to download their tiles for use offline. - You'll also know that many tileservers are incredible slow and may throttle download requests to ensure that bulk downloaders do not overload the tileserver making it impossible for 'normal' requests to be served.
- MOBAC only enables you to bulk download tiles from tileservers up to zoom level 16.
The tileserver may support zoom levels up to 18 but MOBAC is hardcoded to only enable zoom levels up to 16.
This is again an attempt to prevent you from overloading the tileserver. - When you download tiles from a tileserver your tiles are styled by the tileserver.
You have no control over the rendering style of the tiles.
Different tileservers offer differently styled tiles but you have no control over the styles.
MOBAC's support for MapsForge means you can forget about all of these limits and restrictions.
You will need:
- The latest version 2.0 alpha MOBAC:
http://sourceforge.net/projects/mobac/files/Alpha and experimental/
MOBAC requires Java 7 to be installed, i'm using Java 8 and it works fine for me. - A MapsForge database. Download a database that covers the region that you want to create tiles for:
http://download.mapsforge.org/ - To define a new MOBAC Map Source that references your MapsForge database.
An example is given:
B4X:<?xml version="1.0" encoding="UTF-8"?> <mapsforge> <!-- name of the map - as shown in map source list --> <name>Custom Mapsforge</name> <!-- optional --> <minZoom>0</minZoom> <!-- optional --> <maxZoom>20</maxZoom> <!-- absolute or relative file name --> <mapFile>mapsforge-test.map</mapFile> <!-- optional default OSMARENDERER Theme --> <!-- <xmlRenderTheme>mytheme.xml</xmlRenderTheme> --> <transparent>false</transparent> <!-- text size scale factor --> <textScale>1.0</textScale> </mapsforge>
Save this as an XML file in your MOBAC/mapsources directory, the XML filename is not important.
Now start MOBAC and look in the (upper left) list of available Map Sources.
You should see your new 'Custom Mapsforge' Map Source.
Pan the map so that it shows an area covered by your MapsForge database and you'll see MOBAC is rendering and displaying tiles from your MapsForge database.
You can now create an offline tile archive using your new MapsForge Map Source.
Quick and simple with no limits and restrictions.
Now if you want MOBAC to render your tiles with a different style you can create a new custom 'Render Theme'.
Have a look here:
https://github.com/mapsforge/mapsforge/blob/master/docs/Rendertheme.md.
The current default MapsForge Render Theme can be found here:
https://github.com/mapsforge/mapsforge/tree/master/mapsforge-map/src/main/resources/osmarender
osmarender.xml defines exactly how your tiles are styled.
Creating a custom Render Theme can be as simple as changing the color of a feature such as a footpath.
Or you could spend time creating an entirely new Render Theme.
You can download the default MapsForge Render Theme and use it as a base for a new Render Theme.
Once you've created a new Render Theme you need to modify your MapsForge Map Source XML file, uncomment the 'xmlRenderTheme' element and set the path to your new Render Theme.
Restart MOBAC and you should now see your tiles are rendered using your new style.
MapsForge still has ongoing issues with tiles that contain both land and sea - the sea sometimes fails to render as blue.
A solution can be found here:
https://github.com/mapsforge/mapsforge-mapcreator
The MapCreator can be used to convert Open Street Map data into a MapsForge database using a technique which ensures that tiles that contain both land and sea are correctly rendered.
Martin.