15

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

Rahul
  • 2,189
  • 7
  • 40
  • 60

3 Answers3

35

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.

Community
  • 1
  • 1
Chris Cook
  • 2,821
  • 1
  • 20
  • 32
  • 1
    It's bad practise to reference libraries in your code from git/svn repositories. They can be changed/removed/moved any time. That's why people experienced issues with it yesterday. You should download them and include in your project or reference them from some CDN. – Matej P. May 12 '16 at 10:41
  • compiled version is removed now – mokiSRB May 25 '16 at 07:36
8

Here I have links for you :

https://cdnjs.cloudflare.com/ajax/libs/js-marker-clusterer/1.0.0/markerclusterer.js

Markercluster Compiled

https://cdnjs.cloudflare.com/ajax/libs/js-marker-clusterer/1.0.0/markerclusterer_compiled.js
Manjeet Barnala
  • 2,975
  • 1
  • 10
  • 20
  • 1
    Now I am able to load js file, however there one issue related to it, the js file has default image path set to: 'http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/' + 'images/m'; to change this default path either I will have to edit that file, which is not possible if I use CDN as src path or I will have to figure a way to override this default through its options if available. Thanks for the CDN link – Rahul May 12 '16 at 08:40
  • Check [THIS LINK](http://stackoverflow.com/a/7835771/4018240), it will be helpful for you... – Manjeet Barnala May 12 '16 at 08:43
  • @Rahul I've added an additional answer covering using the GitHub hosted version (including the images) which may be useful for you – Chris Cook May 12 '16 at 10:11
1

https://github.com/googlemaps/js-marker-clusterer

with great examples in examples folder and good README. However you need to modify one line of code in each of the examples/*.html files to include your API key:

<script src="http://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY">
</script>

so that each of the three examples work correctly.

Eamonn Kenny
  • 1,926
  • 18
  • 20