Search code examples
javascriptperformancegoogle-mapsgoogle-maps-api-3preload

How to preload some part of google maps?


I'm building a web app with Google Maps API, I need to zoom into an area smoothly, so I use setTimeout to increase the zoom level every second, but in some place with bad network, the map images are loaded too slow that the page quickly turn to a white page....

so my question is is it possible to preload some part of Google Maps(zoom from 3 to 16 of a point)


Solution

  • you could probably pre-load it in a hidden div or iframe.

    but you should make sure it is not against the Google Maps/Google Earth APIs Terms of Service

    10.1.3 Restrictions against Data Export or Copying.

    (b) No Pre-Fetching, Caching, or Storage of Content. You must not pre-fetch, cache, or store any Content, except that you may store: (i) limited amounts of Content for the purpose of improving the performance of your Maps API Implementation if you do so temporarily, securely, and in a manner that does not permit use of the Content outside of the Service; and (ii) any content identifier or key that the Maps APIs Documentation specifically permits you to store. For example, you must not use the Content to create an independent database of “places.”