24

I'm not sure whether to post this here or on Stackoverflow, as it's sort of a crossover. Let me give it a try.

In the proposed HTML5 standard, there's the option of storing web application data in a local cache using a cache manifest. I am looking to use this technique for an offline tiled web map application and did a quick prototype here based on a standard install of Geoserver.

I just ripped the OpenLayers client page that is generated from one of the default layers and changed the <html> tag to

<html xmlns="http://www.w3.org/1999/xhtml" manifest="cache.manifest">

And created the file cache.manifest which simply reads

CACHE MANIFEST
http://lima.schaaltreinen.nl:8080/

Which should, in my limited understanding of the matter, locally cache everything that loads from that URL: all tiles and the OpenLayers JS. In fact, upon first call in Firefox, it does ask me to allow local storage, but when I hit refresh - either online or offline - the page croaks stating that the OpenLayers object is not defined. Looks like it hasn't loaded the OpenLayers JS.

Anyone successfully did a functioning offline OpenLayers-based tiled web map app? Or hints on how to investigate this further?

4 Answers 4

9

You might be interested in the projects Maps on a Stick and MapBox iPad. (disclaimer: designed the former, involved in the latter. however, both are BSD-licensed, and the underlying tile format, termed ".mbtiles", is SQL-based.)

Maps on a Stick is an offline OpenLayers map. The main reasoning for going with a portable database/server instead of client side storage is that using browsers as large data storage isn't quite worked out and populating and indexing the cache can be costly.

2
  • Interesting solution, not what I was thinking about but it looks workable. How easy or difficult is it to load MapBox / Maps on a Stick with custom tile layers?
    – mvexel
    Jan 12, 2011 at 19:41
  • 1
    It's relatively simple: there are a few tools - a C-based importer ( github.com/developmentseed/mb_tiles_importer ), a version of gdal2tiles that outputs mbtiles ( github.com/developmentseed/gdal2mb ), and an upcoming GUI tool.
    – tmcw
    Jan 26, 2011 at 14:18
4

Think you will need to create your own tilecache on 'localhost' see http://code.google.com/p/cumberland/wiki/TilePyramiderAndOpenLayers

Examples

    Using vmap
    http://localhost:8081/vmap0/levelzero/0/0.png
    The tile near the middle of the tile set in the third zoom level of vmap0.
    http://localhost:8081/vmap0/leveltwo/3/4.png
    The tile near the middle of the tile set in the fifth zoom level of landsat2000.
    hhttp://localhost:8081/vmap0/landsat2000/1/8500/8500.png
Source:
    The tile at the origin of the tile set in the first zoom level of basemap.
    http://www.osgeo.org/services/basemap/L1/0/0.png

Note: must not have spaces

3
  • This is useful but requires a local web server, which might not always be feasible, e.g. when you want it to run on an iPhone / iPad. In general, I am looking to achieve this without any requirements on the client side other than a HTML5/cache manifest savvy web browser.
    – mvexel
    Nov 15, 2010 at 11:03
  • 1
    I linked to that page in the original question already. I know this is the way to go, but I am trying to find out if it's feasible at all.
    – mvexel
    Nov 16, 2010 at 8:23
3

One complexity that seems to show up in articles about this is that:

Note that the MIME type of the manifest file is text/cache-manifest.

And the examples all seem to list specific files to cache (but I may need to read further).

1
  • That's one thing that is not clear to me: whether you need to whitelist specific concrete URLs or you can use URL prefixes. I have not been able to test this yet. Anyone who has?
    – mvexel
    Nov 15, 2010 at 11:00
3

Maybe another approach: Geopublisher http://www.geopublishing.org/ can publish your maps for offline use. Geopublisher is a Desktop software that allows you to plug together vector and raster data and create digital maps. Then you can export this map as a stand-alone Java application. It even creates autostart files etc. and does not require a Java installation on the targeted computers.

UPDATE 2018: Geopublisher is not actively developed anymore.

1
  • note: The destination is in German even though the url is to the English language version of the site. To fix locate the [english] link in the left hand navigation column. Mar 28, 2012 at 17:59

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.