[OpenLayers-Dev] Offline Tiles for OpenLayers -reading MbTiles offline in OpenLayers?

Phil Scadden p.scadden at gns.cri.nz
Thu Jun 9 20:37:32 EDT 2011


> Is really TMS tiles offline? Or just reading local tiles still needs
> an internet connection?
My code does something like this:
(lay is object holding data about the layer to create).
                              var pathend = lay.imagePath.lastIndexOf('/');
                              layer[i] = new OpenLayers.Layer.TMS( 
lay.name, lay.imagePath.substr(0,pathend+1),
                                 { type: 'png', alpha: true, 
serviceVersion: '', layername: lay.imagePath.substr(pathend+1),
                                                          maxExtent: new 
OpenLayers.Bounds(lay.imageBounds.left,lay.imageBounds.bottom,lay.imageBounds.right,lay.imageBounds.top).transform(dproj,proj),
                                                          
maxResolution:lay.imageMaxResolution, numZoomLevels:lay.imageZoomLevels,
                                                          zoomOffset:0,
                                  isBaseLayer: lay.baselayer
                                 });

If you use MapTiler to create the TMS directory, it automatically 
creates an openlayers.html file which combines the TMS with OSM, google, 
etc  and you can run this locally. It takes different approach and 
creates its own getTileURL. There are little gotchas regarding tile 
offsets etc depending on actual application usage but the code to find 
the url of right is so simple, its not hard to debug them.
-- 
Phil Scadden, Senior Scientist GNS Science Ltd 764 Cumberland St, 
Private Bag 1930, Dunedin, New Zealand Ph +64 3 4799663, fax +64 3 477 5232

Notice: This email and any attachments are confidential. If received in error please destroy and immediately notify us. Do not copy or disclose the contents.



More information about the Dev mailing list