I have to use my OpenLayers 2 map in an offline stand-alone mode (PC/Laptop disconnected from network).

What is the best way to allow easy capture of map tiles for a region of interest, load them onto the offline laptop and have the OpenLayers 2 map see/use them as its imagery tiles?

  • what about installing Apache on the laptop and using localhost in the browser/openlayers?
    – Zoltan
    Aug 21, 2016 at 17:37

2 Answers 2


You can for example use Tilemill and Mbutil to create offline tiles:

https://www.mapbox.com/tilemill/ (There is already a successor of it called Mapbox Studio but this software still seems to have problems creating offline tiles with mbutils).


In the OpenStreetMap-Wiki there is also a example of how to use offline tiles: https://wiki.openstreetmap.org/wiki/OpenLayers_Local_Tiles_Example

Basically you can use OpenLayers.Layer.OSM for tiles in spherical mercator:

new OpenLayers.Layer.OSM("Local Tiles", "tiles/${z}/${x}/${y}.png")

or OpenLayers.Layer.XYZ for different projections

new OpenLayers.Layer.XYZ("Local Tiles", "tiles/${z}/${x}/${y}.png")

You can use a lot of the offline render engines listed right here: http://wiki.openstreetmap.org/wiki/Rendering

You just have to preemptively load map files to render them into tiles. Once set up you can use XYZ source to load your tiles into an OpenLayers 2 map. If you like Java, I can really recommend mapsforge, it is easy to set up and easy to use.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.