leafletopenlayersopenstreetmapmapsforgeosmosis

Using map.osm and osmarender.xml from Android project in web project


I edited an .osm file and a style file (osmarender.xml) some time ago and included it in an Android project (using osmosis and the Mapsforge library). Works fine and looks good. Now I would like to reuse these files in a web project using OpenLayers (or Leaflet?).

Using this example (https://wiki.openstreetmap.org/wiki/OpenLayers_osm_file_example) I was able to display my (very local, but still 23 MB) map, however, it was all in yellow (no styles applied, of course) and it was rendered on top of the OSM base map.

I want to do the following: 1. Display my map only (no other base map needed or wanted). 2. Display it fast (yet allowing for panning and zooming). 3. Display it using my styles (defined in the osmarender.xml). 4. Display it only as far as it goes (stop panning close to the borders of the bounding box).

Can I do this with OpenLayers (and probably osmosis or some rendering tool)? And if so, how (just about)?


Solution

  • Aarg ... Mapsforge Tile Server is a good hint, however, the answer is much easier as I found out today.

    If you have a working Android map application based on the Mapsforge library you can have this application produce tiles and store them on your mobile device. From there you can copy them and reuse them in a web project with OpenLayers, for example.

    The Android code (with Mapsforge 0.5.2) is in my case as follows:

    TileCache tileCache = AndroidUtil.createTileCache(activity, "mapcache",
                mapView.getModel().displayModel.getTileSize(), this.getScreenRatio(),
                mapView.getModel().frameBufferModel.getOverdrawFactor());
    

    It writes the tiles in the "mapcache" directory.

    Anyway, thank you very much for the help of both of you!