本文介绍了MarkerCluster V3 停止正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用来自 github 的 MarkerCluster_compiled.js.但是,虽然逻辑有效,但它的图形从昨天开始就开始出现故障.

I am using MarkerCluster_compiled.js from github. But while the logic works, its graphics started failing from yesterday.

问题似乎是由https://google-maps-utility-library-v3 引起的.googlecode.com/svn" 返回 404,并且所有集群标记图像都依赖于此 url.(这个 google map v3 svn url 仍然在 google 的公共域中)

The problem seems to be caused by "https://google-maps-utility-library-v3.googlecode.com/svn" returns a 404, and all cluster marker images have dependency on this url. (This google map v3 svn url is still in google's public domain)

在我看来,这个特殊的404"的影响并非微不足道,因为我看到人们的现场网站受到了影响.我很惊讶这个问题会发生在谷歌身上.

Seems to me the impact of this particular "404" is not trivial, as I see people's live sites have been affected. I am surprised this problem could happen to Google.

例如:github.io 上的marker-clusterer 的advanced_example 不再工作(由于我的声誉低,我无法发布链接).

For example:The marker-clusterer's advanced_example on github.io no longer work (I can't post the link due to my low reputation).

期待看到 Google 解决该问题或任何其他建议.

Looking forward to see Google fix the issue or any other suggestion.

推荐答案

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:

谷歌地图无法在 https://

虽然上述网址(带有 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 存储库的保管人尚未创建任何版本,因此目前无法实现.

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

这篇关于MarkerCluster V3 停止正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 02:49