ruby on rails - how to show latitude, longitude information in Gmaps Heatmap -
i integrating gmaps heatmap ruby on rails able plot data on unable show latitude, longitude , place information in pop-up box. following method in controller , have defined in route.rb
def plot_map @records = place.where("keyword_id = ?",params[:place_keyword_id]).order("created_at desc") @places = gmaps4rails.build_markers(@records) |user, marker| marker.lat user.latitude marker.lng user.longitude end
i have view plot_map.html.erb
<script> $(document).ready(function() { var mylatlng = new google.maps.latlng(25.6586, -80.3568); // map options, var myoptions = { zoom: 3, center: mylatlng }; // standard map map = new google.maps.map(document.getelementbyid("map-canvas"), myoptions); // heatmap layer heatmap = new heatmapoverlay(map, { // radius should small if scaleradius true (or small radius intended) "radius": 2, "maxopacity": 1, // scales radius based on map zoom "scaleradius": true, // if set false heatmap uses global maximum colorization // if activated: uses data maximum within current map boundaries // (there red spot uselocalextremas true) "uselocalextrema": true, // field name in data represents latitude - default "lat" latfield: 'lat', // field name in data represents longitude - default "lng" lngfield: 'lng', // field name in data represents data value - default "value" valuefield: 'count' } ); var testdata = { max: 8, data:<%= raw @places.to_json%> }; heatmap.setdata(testdata); });
when click on heated section. can display latitude, longitude in pop-box infowindow?
Comments
Post a Comment