[OpenLayers-Users] Accessing OSM raster map files on local storage

Aleksei Valikov valikov at gmx.net
Sun Feb 12 07:10:15 EST 2012


Hi,

> I see that there is a interface for access vector data through the
> deprecated gears library, but is there any facility for access raster
> map data as base layers from local storage?  This would be a really
> handy coupled with html5 for mobile devices.

We are using "File API: Directories and System"
(http://www.w3.org/TR/file-system-api/) for this.

* Raster data is stored on the local file system somewhere in
<app>/layers/<layerId> directory
* We configure layers as XYZ or WMTS/REST layers. Layer URL is
prepended with layerDirectory.toURI()
* This results in an URL like file:///mnt/sdcard/<app>/layers/<layerId>....

As long as raster image catalog respects the directory structure of
the layer type (like, ${z}/${x}/${y}.png for XYZ layers), OpenLayers
has no problem showing the "offline" raster data in the map.

BTW, we use PhoneGap to make it truly multi-platform, but it also
works in compatible browsers (Chrome, Safari) out of the box without
PhoneGap.

Bye,
/lexi


More information about the Users mailing list