Search code examples
javascriptruby-on-railsgoogle-mapsgoogle-maps-api-3gmaps4rails

Where is the Google Marker Cluster?


After adjusting to the new movements from Google to Git, one issue still persists.

http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclustererplus/images/m1.png Failed to load resource: the server responded with a status of 404 (Not Found)

What shall I do get the marker cluster rendered on the map, instead of a ? ?

I am using a coffee script:

class RichMarkerBuilder extends Gmaps.Google.Builders.Marker #inherit from builtin builder
  #override create_marker method
  create_marker: ->
    options = _.extend @marker_options(), @rich_marker_options()
    @serviceObject = new RichMarker options #assign marker to @serviceObject

  rich_marker_options: ->
    marker = document.createElement("div")
    marker.setAttribute 'class', 'marker_container'
    marker.innerHTML = @args.title
    _.extend(@marker_options(), { content: marker })

  infobox: (boxText)->
    content: boxText
    pixelOffset: new google.maps.Size(-140, 0)
    boxStyle:
      width: "300px"

  # override method
  create_infowindow: ->
    return null unless _.isString @args.infowindow
    boxText = document.createElement("div")
    boxText.setAttribute("class", 'marker_info_box') #to customize
    boxText.innerHTML = @args.infowindow
    @infowindow = new InfoBox(@infobox(boxText))

@buildMap = (markers)->
    handler = Gmaps.build 'Google', { builders: { Marker: RichMarkerBuilder} } #dependency injection

    #then standard use
    handler.buildMap { provider: {}, internal: {id: 'map'} }, ->
      markers = handler.addMarkers(markers)
      handler.bounds.extendWith(markers)
      handler.fitMapToBounds()

Solution

    1. Download this image and include it in your project: https://cdn.rawgit.com/googlemaps/js-marker-clusterer/gh-pages/images/m1.png

    2. Search (CTRL+SHIFT+F on most of IDEs, depends on what IDE/platform you are using) your whole project, including libraries for this string "http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclustererplus/images/m1.png"

    3. Replace the found occurrence(s) with link to the downloaded image.

    (Please don't reference the image directly from https://cdn.rawgit.com... as the URL can change in the future again, as it did couple of weeks ago and you will have the same problem. Just download it between your project's image files and reference it from there)