如何通过缓存制作离线地图(使用传单 OSM)? [英] How to make offline maps(using leaflet OSM) , by caching?

查看:37
本文介绍了如何通过缓存制作离线地图(使用传单 OSM)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过浏览器中的缓存 (IndexedDB) 制作离线地图.我理解这个概念是我在连接到互联网时首先下载并存储地图图块.

I am trying to make offline maps through caching (IndexedDB) in browser. I understand the concept is that I download and store the tiles of map first when connected to internet.

然后我必须在逻辑上离线加载图块.

Then I have to load the tiles logically offline.

但是,我无法弄清楚.

如何存储它们以及如何在逻辑上再次加载它们?我被困在这里.我正在为地图使用 leaflet API.如何实现?

How do I store them and how to load them again logically? I'm stuck here. I am using the leaflet API for maps. How can this be implemented?

推荐答案

查看我对此的广泛研究:

See my extensive research on this at:

为离线 Web 应用程序存储图像数据(客户端存储数据库)

在:

https://gis.stackexchange.com/questions/44813/database-for-offline-slippy-map-tiles

您想要做的关键是从数据库中获取内容的功能切片层:

Key for what you want to do is a Functional Tile layer to get stuff from the DB:

https://github.com/ismyrnow/Leaflet.functionaltilelayer

顺便说一句,我刚刚为此测试了 PouchDB,它比原始 IndexeDB 干净得多.

BTW, I am just now testing out PouchDB for this, which is much cleaner that the raw IndexeDB.

在以下位置关注我的结果:

Follow my results at:

https://groups.google.com/forum/?fromgroups#!topic/pouchdb/RG6wUsAi2R0

这篇关于如何通过缓存制作离线地图(使用传单 OSM)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆