[OpenLayers-Users] Pre-seeding localStorage

Greg Allensworth gregor at greeninfo.org
Wed May 8 07:46:36 PDT 2013


On 5/8/2013 6:30 AM, Jurrie Overgoor wrote:
> I am making a webapp with OpenLayers and I want to use the localStorage
> for offline situations. I want to give the users the ability to preload
> the tiles in the localStorage.

> My map is displaying a route with a maxExtend bounding box. I know this
> bounding box beforehand. So I need a mechanism to translate a Bounds
> object into tile urls for each zoom level. Maybe someone can push me in
> the right direction, or even has an example that does something similar?

Check out MobileMapStarter on Github. Look in cache.js specifically.

It saves to file storage, which isn't quite the same, but it does 
include the logic for translating a bounding box into a set of XYZ tile 
URLs.

https://github.com/gregallensworth/MobileMapStarter/blob/master/libs/cache.js

Look for seedCache()


-- 
Greg Allensworth, Web GIS Developer
BS  A+  Network+  Security+  Linux+  Server+
GreenInfo Network - Information and Mapping in the Public Interest
564 Market Street, Suite 510  San Francisco CA 94104
PH: 415-979-0343 x302  FX: 415-979-0371    email: gregor at greeninfo.org
Web: www.GreenInfo.org     www.MapsPortal.org

Subscribe to MapLines, our e-newsletter, at www.GreenInfo.org


More information about the Users mailing list