google markerclusterer.js库的备用源路径是什么? [英] what is the alternate source path for google markerclusterer.js library?

查看:110
本文介绍了google markerclusterer.js库的备用源路径是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,我包含这样的库:

 < script src =http:// google- maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/src/markerclusterer.js\"></script> 

然而src路径似乎从昨天开始就被破坏了,因此它不会渲染JS,因此我无法在地图上显示集群。



我有这个JS的本地副本,我可以设置src路径来引用我的本地副本而不是上面的。 ./svnt/runk/.. path。



我在搜索的是这个库的其他路径吗?可能它是在CDN上托管的。



到目前为止,我认为,上面只是 它的托管地点:



参考: https://代码.google.com / p / google-maps-utility-library-v3 / source / checkout

解决方案

Google将源代码移至GitHub 过了一段时间,新的 GitHub版本可以从 RawGit 通过使用以下脚本url:

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

在实例化MarkerClusterer以访问G中的图像时,还需要指定imagePath选项itHub:

  var mc =新的MarkerClusterer(地图,标记,{
imagePath:'https:// cdn。 rawgit.com/googlemaps/js-marker-clusterer/gh-pages/images/m'
});

以下较早的SO帖子包含更多关于集群映像的imagePath引用的详细信息:



Google地图不适用于https://



虽然上述网址(带有cdn前缀)的没有流量限制或限制,并且提供了文件通过超快速的全球CDN ,请记住: RawGit是一项免费的托管服务,并且不提供正常运行时间或支持担保



在下面的回答中有更详细的介绍:



链接并执行外部JavaScript文件托管在GitHub上



这篇文章还涵盖了,如果你正在链接到GitHub上的文件,在制作过程中,您应该考虑定位特定的发布标签,以确保您获得脚本的特定发布版本。 b

然而,由于js-marker-clusterer存储库的管理员尚未创建任何版本,因此目前尚不可能。

因此,您应该认真考虑下载并将库和资源直接包含在您的项目中以用于生产目的。


in my project I am including this library like this:

<script src="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/src/markerclusterer.js"></script>

however the src path seems to be broken since yesterday hence it is not rendering the JS thus I am unable to show clusters on the map.

I do have the local copy for this JS, I can set src path to refer to my local copy instead of above ../svnt/runk/.. path.

What I am searching is there any alternative path for this library? May be it is hosted on CDN.

So far, I think, above is only the place where it is hosted:

Ref: https://code.google.com/p/google-maps-utility-library-v3/source/checkout

解决方案

As Google moved the source over to GitHub a while back, the new GitHub version can be accessed from RawGit by using the following script url:

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

You'll also need to specify the imagePath option when instantiating your MarkerClusterer to access the images from GitHub:

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

The following earlier SO post contains more detail regarding the imagePath reference to the cluster images:

Google maps not working in https://

Whilst the above urls (with the cdn prefixes) have no traffic limits or throttling and the files are served via a super fast global CDN, please bear in mind that RawGit is a free hosting service and offers no uptime or support guarantees.

This is covered in more detail in the following SO answer:

Link and execute external JavaScript file hosted on GitHub

This post also covers that, if you're linking to files on GitHub, in production you should consider targeting a specific release tag to ensure you're getting a specific release version of the script.

However, as the custodians of the js-marker-clusterer repository have yet to create any releases, this isn't currently possible.

As a result, you should seriously consider downloading and including the library and its resources directly in your project for production purposes.

这篇关于google markerclusterer.js库的备用源路径是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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