I am using gmap4rails, my rails version is 4.
In earlier version we can use the map options like below:
<%= gmaps("markers" => { "data" => @markers, "options" => { "randomize" => true, "width" => 22, "length" => 32 } }) %>
Below is my latest gmap4rails version code:
<div style='width: 800px;'>
<div id="multi_markers" style='width: 520px; height: 350px;'></div>
</div>
<script>
var handler = Gmaps.build('Google');
handler.buildMap(internal: {id: 'multi_markers'}}, function(){
var markers = handler.addMarkers(<%=raw @data.to_json %>);
handler.bounds.extendWith(markers);
handler.fitMapToBounds();
});
</script>
I want to display the multiple marker for one location. For that I want to add the map options "randomize and max_random_distance
" in my gmap. How can I add this in my latest version of gmap4rails. Please help me out. Thanks in advance!!!.
You dont need to edit the source, you can pass params:
handler = Gmaps.build('Google', { markers: { maxRandomDistance: 100 } });