HTML5 offline google map access

…衆ロ難τιáo~ 提交于 2020-01-01 07:21:07

问题


We are developing a HTML5 application which has a Google map to change the location of search. Now this app has an offline version too. Is there any way i can cache the Google map & when the application is offline, it will show the offline version?

And how could we enable the user to change the location again?


回答1:


There is not currently any caching mechanism in place for google maps, in fact the map tiles that are downloaded explicitly have the nocache header specified (interestingly, there is work being done on caching for the Android version of maps, but it is still experimental). In order to leverage maps offline, you would likely need to roll your own caching scheme.

With the explosion of mobile devices, and the probability of being disconnected at some point while using a mobile device, it wouldn't surprise me if Google did add offline browsing capability to maps at some point in the future though (maybe v4?).

UPDATE:

There is a feature request in the public issue tracker:

https://code.google.com/p/gmaps-api-issues/issues/detail?id=8914

Please star this feature request to express your interest and receive further updates from Google.




回答2:


I made an HTML5 application with a cached map, however it was not a Google Map. I used the tiledownloader from http://search.cpan.org/~rotkraut/Geo-OSM-Tiles-0.02/downloadosmtiles.pl and downloaded the areas I needed using Mapquest's Open tile server because they don't have a hit limit. I then iterated over all of the tiles with a script and added them to the cache.manifest file. Then I just use Leaflet by Cloudmade to map the tiles.



来源:https://stackoverflow.com/questions/10162016/html5-offline-google-map-access

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!