apneadiving / Google-Maps-for-Rails

Enables easy Google map + overlays creation in Ruby apps
https://apneadiving.github.io/
MIT License
2.27k stars 382 forks source link

heatmap layer (and other layers) #475

Closed ultramaroon closed 9 years ago

ultramaroon commented 9 years ago

I am using the Gmaps4Rails gem and by following the wiki/readme, I have successfully created a map with points (pins).

The javascript looks like this:

handler = Gmaps.build('Google'); handler.buildMap({ provider: { }, internal: { id: 'map' } }, function(){ json_array = #{raw(@hash.to_json)}; markers = handler.addMarkers(jsonarray); .each(json_array, function(json, index){ json.marker = markers[index]; });

createSidebar(json_array);

handler.bounds.extendWith(markers);
handler.fitMapToBounds();

});

I would like to create a heatmap layer that can be toggled on and off, which would show instead of the pindrops. Despite looking through the Wiki as well as the Google Maps api (https://developers.google.com/maps/documentation/javascript/examples/layer-heatmap) I am quite lost as to how to initialize the layer and show it. Does it go into the the same handler variable or do I have to create something new entirely?

I've also posted on stackoverflow: http://stackoverflow.com/questions/28261039/creating-a-heatmap-layer-in-gmaps4rails, though no one's really looking. I also saw that someone had mentioned the trafficlayer in the issues, but there didn't seem to be a resolution. (or that it just wasn't implemented yet, but I couldn't figure out any implementation for other layers.)

apneadiving commented 9 years ago

of course its doable, but its out of the gem's scope. It would demand some work and sorry but I wont do free consulting here.

jhalakrajesh commented 7 years ago

Hey, Can you please tell me how to use the heat map layer on the gmaps4rails.