最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

html - google maps offline: not tiles but javascript - Stack Overflow

programmeradmin3浏览0评论

I have an HTML (phonegap) application that uses Google Maps API to display a map with markers. I want this app to be used offline. I know that Google Maps tiles can't be used offline (because of its license). However, what I want to do is use the map interface without the tiles.

When online -> tiles and markers displayed.

When offline -> only markers displayed.

However, the js loading of Google maps is plex, and I haven't managed to cache it.

Thanks.

I have an HTML (phonegap) application that uses Google Maps API to display a map with markers. I want this app to be used offline. I know that Google Maps tiles can't be used offline (because of its license). However, what I want to do is use the map interface without the tiles.

When online -> tiles and markers displayed.

When offline -> only markers displayed.

However, the js loading of Google maps is plex, and I haven't managed to cache it.

Thanks.

Share Improve this question edited Sep 17, 2013 at 2:05 kazinix 30.2k36 gold badges111 silver badges162 bronze badges asked May 31, 2013 at 14:48 MateuMateu 2,6986 gold badges38 silver badges56 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 6

Caching google maps javascript is not allowed, that's because their payment system is based on how many times their javascript API are loaded by the users. One page refresh is equal to one google maps API call, and depending what kind of contract you made you just lost -1 from the total amount of API requests you have purchased.

How is Google Maps API for Business usage tracked and reported?

A single load of the Google Maps JavaScript API into a page. The JavaScript API is reloaded every time a page that uses the API is reloaded. User interactions with the map (eg. panning, zooming, changing map types) do not generate more page views. Note however that a page view is generated if the API is loaded into the page even if the API is not then used to display a map.

See https://developers.google./maps/documentation/business/faq#pageview

You could, of course contact google and try to ask some tailored business solution for your needs. I am not 100% sure what kind of things they offer if you contact them directly. But although, your request is somewhat impossible to fill since those UI generation codes also resides inside that google maps API javascript which you need.

So I would suggest that if you only need google maps interface when offline, take a moment and implement something similar with HTML/CSS/ (and some JS).. markers you could draw on canvas or use normal img's and positioning. If you need to implement dragging and zooming - it would be little bit more difficult but not impossible with canvas or some other techniques. But that being said it would just be easier to keep app online, we all have internet :) ? Making 1on1 matching dummy offline UI against google maps would be really painful process, when we consider the fact that google maps UI also changes overtime, like in their uping versions.

You could use OpenStreetMaps instead, it can be used offline: http://wiki.openstreetmap/wiki/Offline_Openstreetmap

发布评论

评论列表(0)

  1. 暂无评论