Creating a heatmap layer in Gmaps4Rails

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(json_array);
    _.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?

Answers:

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.