问题描述
在我的项目中,我包含这样的库:
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>
然而,src 路径似乎从昨天开始就被破坏了,因此它没有呈现 JS,因此我无法在地图上显示集群.
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.
我有这个 JS 的本地副本,我可以设置 src 路径来引用我的本地副本而不是上面的 ../svnt/runk/.. 路径.
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.
我在搜索这个库有没有其他替代路径?可能它托管在 CDN 上.
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:
参考:https://code.google.com/p/google-maps-utility-library-v3/source/checkout
推荐答案
As Google 不久前将源转移到 GitHub,新的 GitHub 版本 可以从 RawGit 使用以下脚本网址访问:
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
在实例化 MarkerClusterer 以从 GitHub 访问图像时,您还需要指定 imagePath 选项:
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'
});
以下较早的 SO 帖子包含有关集群图像的 imagePath 引用的更多详细信息:
The following earlier SO post contains more detail regarding the imagePath reference to the cluster images:
虽然上述网址(带有 cdn 前缀)没有流量限制或节流,但文件通过超快速的全球 CDN 提供,请记住 RawGit 是一项免费托管服务,不提供正常运行时间或支持保证.
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.
这在以下 SO 答案中有更详细的介绍:
This is covered in more detail in the following SO answer:
链接并执行托管在 GitHub 上的外部 JavaScript 文件
这篇文章还介绍了,如果您要链接到 GitHub 上的文件,那么在生产中,您应该考虑定位特定的发布标签,以确保您获得脚本的特定发布版本.
但是,由于 js-marker-clusterer 存储库的保管人尚未创建任何版本,因此目前无法实现.
因此,您应该认真考虑将库及其资源直接下载并包含在您的项目中以用于生产目的.
这篇关于google markerclusterer.js 库的备用源路径是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!