Reputation: 7914
I want to generate heat map from a set of data which is latitude & longitude. I've 20,000+ latitude & longitudes in a text file.
Can any one tell me how to generate heat map?
I'll appreciate if some one can provide me free version of heat map.
Thanks!
Upvotes: 8
Views: 23281
Reputation: 11
StringBuilder sb = new StringBuilder();
sb.Append("<script>");
sb.Append(" var latlng = new google.maps.LatLng(18.345, 79.497);");
sb.Append("var myOptions = { zoom: 7, center: latlng, mapTypeId: google.maps.MapTypeId.satellite };");
sb.Append("var map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);");
sb.Append("var heatmap = new google.maps.visualization.HeatmapLayer({ data:[");
for (int i = 0; i < dreal.Rows.Count; i++)
{
string str = "new google.maps.LatLng(" + dreal.Rows[i][0].ToString() + "," + dreal.Rows[i][1].ToString() + ")";
if (i> 0)
{
sb.Append(",");
}
}
sb.Append("]");
sb.Append(", map: map });");
sb.Append("</script>");
Page.ClientScript.RegisterStartupScript(this.GetType(), "ArrayScript", sb.ToString());
Here I am generating javascript from backend and I am taking datatable values which are having two columns for longitude and latitude. and I am taking one of the datatable for initializing the map variable.
Upvotes: 1
Reputation: 310
Another useful website for heatmap is http://www.openheatmap.com
Also a blog discusses about heatmap: http://blog.smartbear.com/web-monitoring/the-heat-is-on-a-simple-guide-to-creating-heatmaps/
Upvotes: 1
Reputation: 11773
Simpleheatmap.com will let you plot latitude & longitude coordinates on an interactive heatmap for free. No limit on the number of lat/lon pairs you can plot, though as of the time of this writing it's in beta so that might change. The site also has the ability to geocode addresses and other geographic data and plot them as well, but there are limits on how many geocoding attempts you can make.
Upvotes: 1
Reputation: 8819
There's an open source library called heatmap.js which might work for you. It's HTML5 based so won't work in older browsers though. They also have a GMaps Heatmap Overlay, so it's fairly plug and play.
Upvotes: 5