[OpenLayers-Users] caching tiles with phonegap

Steve Nelson snelson at webapper.com
Fri Mar 23 09:20:21 EDT 2012


That's exactly what i was thinking about doing. I made something similar to
that with Google Maps using HTML5's file object. It took a tremendous
amount of work trying to figure out where to put that code in gmaps but I
eventually found it. Of course it broke the TOS. It worked great on Chrome,
but that's when I discovered Phonegap didn't support the file download.

Now that they do support it, I want to make it work in OpenLayers. The
thing that I learned from doing this with Google Maps is that the file
download object uses an asynchronous callback functions which means I can't
just return a function call if the local file doesn't exist. But if the
file does exist, that function can just return the local URL.

It shouldn't be too hard to do this, but if anyone is familiar with the
inner workings of openlayers that would certainly help.

Steve

On Thu, Mar 22, 2012 at 4:37 PM, Tue Topholm <tt at sugee.dk> wrote:

> The easiest thing to do is to make a a getUrl function on the layer,
> then send the request PG and store the url in a localstorage, and sent
> the url back to OL, next time it will call it, you check your local
> storage, to see if it saved, and if it is, give OL the local path the
> tile, else give the server url.
>
>
> --
>
> Med venlig hilsen / Kind regards
>
> Tue Topholm
> Sugee
> Tlf: +45 32 13 32 32
> W: http://www.sugee.dk
>
>
>
> 22. mar. 2012 16.30 skrev Steve Nelson <snelson at webapper.com>:
> > Phonegap recently added a download method to their File object.
> >
> >
> http://docs.phonegap.com/en/1.5.0/phonegap_file_file.md.html#FileTransfer
> >
> > The advantage of this is there is no disk space limit (as far as I know)
> > which the "storage" method has. I want to build this caching technique
> into
> > openlayers. Anyone want to help?
> >
> > Steve
> >
> > _______________________________________________
> > Users mailing list
> > Users at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/openlayers-users
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120323/83e21ade/attachment.html


More information about the Users mailing list