[OpenLayers-Dev] WorldWind cache proposal
Andrew Larcombe
andrew at andrewlarcombe.co.uk
Fri Nov 2 12:36:28 EDT 2007
Hi List,
I have the following proposals for additions to the WorldWind classes
within OpenLayers that I'd like your feed back on.
Regards,
Andrew
Proposal to add local caching options to WorldWind classes in OpenLayers
Scope
This document covers the proposal of additional functionality to
OpenLayers to be able to use locally stored WorldWind cache files
when the URI of the page containing the OpenLayers map is of a file:
scheme.
Motivation
Although Worldwind data is most commonly used in an client-server
based online environment, it is possible to download WorldWind cache
files for offline use[1]. OpenLayers contains a class to access
server-based WorldWind caches using a well defined URL naming scheme,
but there is no functionality to retrieve some or all tiles for a
request from a local WorldWind cache.
Proposals
The existing WorldWind class, OpenLayers.Layer.WorldWind, contains
the logic to determine which tile to display given a bounding box.
This can be found in the method OpenLayers.Layer.WorldWind.getURL.
The three key values it calculates, zoom, x and y can be used, with
correct formatting rules applied, to retrieve an image tile from a
local WorldWind cache directory instead of a remote server.
Proposal 1
Function OpenLayers.Layer.WorldWind.getURL to be modified to return a
file scheme URI of a tile in a local WorldWind cache - the directory
of which has been specified by the url parameter in the constructor
of the layer.
eg
ww = new OpenLayers.Layer.WorldWind( "WorldWind", "file:///Volumes/
homes/mapdata/NASA/World Wind 1.3/Cache/BMNG/BMNG (Shaded +
Bathymetry) Tiled - 1.2004/", 36, 4);
would create a new layer which would retrieve images from the
WorldWind cache located in the local directory /Volumes/homes/mapdata/
NASA/World Wind 1.3/Cache/BMNG/BMNG (Shaded + Bathymetry) Tiled -
1.2004/.
Proposal 2
Rather than choose between whether to retrieve files from a local
cache or a remote server at development time it may be advantageous
to retrieve some tiles (eg those at a high zoom level) from a local
cache, with others being retrieved from a remote server. To enable
this an entry in the options array of the OpenLayers.Layer.WorldWind
constructer could be used to indicate the location of a local cache
directory. The function OpenLayers.Layer.WorldWind.getURL could then
detect whether the local cache contains data for the particular zoom
level that has been requested using the
Components.interfaces.nsILocalFile (Mozilla-based browsers) or
Scripting.FileSystemObject (Internet Explorer) components[2]. If data
is available in the local WorldWind cache then getURL will return the
URI to that tile, else it will return the URI to the tile on the
remote server.
eg
ww = new OpenLayers.Layer.WorldWind( "WorldWind", "http://
worldwind25.arc.nasa.gov/tile/tile.aspx?", 36, 4,{T:"bmng.topo.bathy.
200406"},{cache:"/Volumes/homes/mapdata/NASA/World Wind 1.3/Cache/
BMNG/BMNG (Shaded + Bathymetry) Tiled - 1.2004/"});
would create a new layer which would retrieve images from the
WorldWind cache located in the local directory /Volumes/homes/mapdata/
NASA/World Wind 1.3/Cache/BMNG/BMNG (Shaded + Bathymetry) Tiled -
1.2004/ , if that directory contains data for the requested zoom
level, else it would attempt to retrieve it from the server at http://
worldwind25.arc.nasa.gov/tile/tile.aspx?
[1] - eg http://www.worldwinddata.com/
[2] - Using a Javascript-only approach this functionality would be
limited to these two browser types.
--
Andrew Larcombe
Freelance Geospatial, Database & Web Programming
web: http://www.andrewlarcombe.co.uk
email: andrew at andrewlarcombe.co.uk
icq: 306690163
More information about the Dev
mailing list