I tried to search the answer from docs, but couldn’t find..
How can I enable clustering in Gmaps4rails when I add markers on the map via AJAX. My view has this:
<%= gmaps( map_options: { zoom: 15, auto_adjust: false } ) %>
and in my javascript I add the markers like this:
$.getJSON(path, { lat: lat, lng: lng, user_lat: user_lat, user_lng: user_lng }, function(markers_json) {
Gmaps.map.replaceMarkers(markers_json);
});
I’d just like to set the do_clustering option to true, but because I don’t have markers json in the map gmaps() call, I can’t add the markers options either.
Tell
gmaps4railsdirectly:And include this script: