2016-05-13 72 views
0

我使用谷歌地图工具中的key draggable zoommarkers cluster库。从今天下午我无法加载这两个库的源脚本。它似乎所有谷歌地图实用程序svn引用已关闭。有任何想法吗?google map utility svn down?

回答

1

在你的情况下,下面的脚本的URL覆盖keydragzoom库(标准和包装版本):

https://cdn.rawgit.com/googlemaps/v3-utility-library/master/keydragzoom/src/keydragzoom.js 
https://cdn.rawgit.com/googlemaps/v3-utility-library/master/keydragzoom/src/keydragzoom_packed.js 

和下面覆盖markerclusterer(标准和编译):

https://cdn.rawgit.com/googlemaps/js-marker-clusterer/gh-pages/src/markerclusterer.js 
https://cdn.rawgit.com/googlemaps/js-marker-clusterer/gh-pages/src/markerclusterer_compiled.js 

你”在实例化MarkerClusterer以访问来自GitHub的图像时,还需要指定imagePath选项:

var mc = new MarkerClusterer(map, markers, { 
    imagePath: 'https://cdn.rawgit.com/googlemaps/js-marker-clusterer/gh-pages/images/m' 
}); 

上述方法,特异性设定的ImagePath位置,是必需的,因为MarkerClusterer库目前仍然含有(在2016五月13日)在下述的硬编码参照退役位置:

MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_PATH_ = 
    'https://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/' + 
    'images/m'; 

在生产中,应该使用上面的url(带有cdn前缀),因为它们有no traffic limits or throttling and the files are served via a super fast global CDN。但请记住,作为免费服务,它提供no uptime or support guarantees

从Git的托管访问文件进行了更详细的在下面的SO回答:

Link and execute external JavaScript file hosted on GitHub

+0

好的解决方案!感谢帮助! – zxue