So much good information. Thank you all so much for these responses. I will take the later part of this week digging through all of the suggestions and trying the methods. I guess what I am trying to do seems to be more choropleth than heatmap, due to the fact that I don't want any areas without color, I want it to be interpolated off of the nearest point. I am sure I will be back on here asking more about this, but for the time being I have been given some great code and directions. Thanks again Tamas, Brent, and all of the others. What a great bunch of help. <div>
<br></div><div>Thanks,</div><div><br></div><div>Daniel</div><div><br></div><div>
<br><br><div class="gmail_quote">On Wed, Feb 23, 2011 at 12:41 PM, <span dir="ltr"><<a href="mailto:pcreso@pcreso.com">pcreso@pcreso.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top" style="font:inherit">Hi Daniel,<br><br>Points to voronoi for mapping is surely a chloropleth more than a heatmap? Colouring polygons by value? A heat map is generally done by rendering a surface generated from point data.<br>
<br>From the original question I'm not sure if simply plotting coloured points on the map is required, or some sort of aggregation of the point data by polygon.<br><br>I _think_ the intent is to take sets of points, each within a polygon (field), generate a surface within each polygon based on the point values, then render each surface to form a heatmap (the rendered map thus comprising a set of polygons, each of which is represented by its own heat map) ???<br>
<br><br>For a more elegant GIS based approach, I'd use GMT to render a static map for a web page, which was the intent behind original question. Mapserver is more for dynamic/interactive web
mapping.<br><br>See: <a href="http://gmt.soest.hawaii.edu/gmt/doc/gmt/pdf/GMT_Docs.pdf" target="_blank">http://gmt.soest.hawaii.edu/gmt/doc/gmt/pdf/GMT_Docs.pdf</a><br><br>For different ways of showing the values of points on a map see the examples on pages 120, 121, 138, 141, 144, etc. And there are many others with a tool this powerful (& complex) including generating & plotting surfaces derived from point data (for heat maps)<br>
<br>You write a script to build the map, much as in the p141 example, which shows how GMT can create a complex legend automatically as well, and run the script whenever a new or updated map is required.<br><br>The GMT list (IMHO) is a helpful & supportive as any mailing list I've encountered, even this one!!<br>
<br>A script which iterates through each field (set of points) generating each constrained surface and inserting it to a grid, then rendering the entire grid for your map output would do this pretty easily.<br><br>See the GMT docs for the commands <span style="font-style:italic">surface</span> for one way to generate each field of points as a grid, <span style="font-style:italic">grdmath</span> for how to merge these into one grid, & <span style="font-style:italic">grdimage</span> for how to generate the map from these gridded data. Or you could just render each field separately with grid points outside the field polygon set to NAN & rendered transparent.<br>
<br>Or throw all the points into a surface, render this as a single heat map & overlay the fields as transparent polygons (optionally labelled) with perhaps the regions between polygons masked if appropriate?<br><br>Lots of ways of generating such maps :-)<br>
<br>If you'd like some help going down this path, contact me off list.<br><br>Cheers,<br><br> Brent Wood<br><br><br><br><br>--- On <b>Thu, 2/24/11, Puneet Kishor <i><<a href="mailto:punk.kish@gmail.com" target="_blank">punk.kish@gmail.com</a>></i></b> wrote:<br>
<blockquote style="border-left:2px solid rgb(16, 16, 255);margin-left:5px;padding-left:5px"><br>From: Puneet Kishor <<a href="mailto:punk.kish@gmail.com" target="_blank">punk.kish@gmail.com</a>><br>Subject: Re: [mapserver-users] Heatmap / choropleth from points attributes<br>
To: "Milo van der Linden" <<a href="mailto:milo@dogodigi.net" target="_blank">milo@dogodigi.net</a>><br>Cc: <a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
Date: Thursday, February 24, 2011, 6:23 AM<div><div></div><div class="h5"><br><br><div>On Wed, Feb 23, 2011 at 04:28:31PM +0100, Milo van der Linden wrote:<br>> Turning points into polygons (or voronois) is the "thinking like a GIS<br>
> professional" approach. This is valid, but not as good as it can get.<br>> Basically, using imaging techniques would be a better approach.<br><br>Very well put.<br><br>> <br>> Perhaps you can take this: <a href="http://www.sethoscope.net/heatmap/" target="_blank">http://www.sethoscope.net/heatmap/</a> as a starting<br>
> point? The author has created a nice python script to generate a heatmap.<br><br>And here is a Perl-based approach<br>[<a href="http://blog.imtrevor.com/2009/07/16/generating-heat-maps-using-perl/" target="_blank">http://blog.imtrevor.com/2009/07/16/generating-heat-maps-using-perl/</a>]<br>
<br><br>> <br>> 2011/2/23 Josh Jordan <<a href="http://mc/compose?to=outerspaceman81@yahoo.com" target="_blank">outerspaceman81@yahoo.com</a>><br>> <br>> > First, you have to turn your points into shapes, theres some algorithm that<br>
> > will turn points into polygons with borders midway between each point.<br>> > Then, you have to add classes to the mapfile. Add one class per color.<br>> > You have to calculate the bounds and color for each class like this:<br>
> ><br>> > CLASS<br>> > EXPRESSION(([POPULATION] gt 90457) AND ([POPULATION] le 108397))<br>> > STYLE<br>> > COLOR 10 20 50<br>> >
END<br>> > END<br>> ><br>> > If your CSV data isnt joined to the mapserver data, you have to calculate<br>> > what shapes are in each bucket like this-<br>> ><br>> > CLASS<br>> > EXPRESSION(([NAME] = "Shape1") OR ([NAME] = "Shape2"))<br>
> > STYLE<br>> > COLOR 10 20 50<br>> > END<br>> > END<br>> ><br>> > --- On *Tue, 2/22/11, Daniel Cole <<a href="http://mc/compose?to=daniel@southernsolutionsms.com" target="_blank">daniel@southernsolutionsms.com</a>>* wrote:<br>
> ><br>> ><br>> > From: Daniel Cole <<a href="http://mc/compose?to=daniel@southernsolutionsms.com" target="_blank">daniel@southernsolutionsms.com</a>><br>> > Subject: [mapserver-users] Heatmap / choropleth from
points attributes<br>> > To: <a href="http://mc/compose?to=mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>> > Date: Tuesday, February 22, 2011, 10:06 PM<br>> ><br>
> > I am a new mapserver user and have spent countless hours over the last<br>> > month reading, trying code, etc. before posting here for help. I am trying<br>> > to generate an image (non-interactive) on a webpage based off of attribute<br>
> > data in a points file. For example, 20 different points equally distributed<br>> > in a field contain data about the moister level of the soil. I want to make<br>> > the lowest levels blue and the highest levels yellow, or something like that<br>
> > with some gradients in between. If possible I want it to have interpolated<br>> > data between them to show the gradual change, but that isn't a
must. I<br>> > also want to wrap it in a polygon that trims the edges.<br>> ><br>> > I found some python code that I thought might do the trick , but it seems<br>> > lots of heat maps are based off of how many points exist in a certain area,<br>
> > and thats now what I am doing.<br>> ><br>> > My points contain numbers in the attributes, 5, 25, 92, 71, etc. I feel<br>> > like I am missing some easy way to do this right in front of me with gdal or<br>
> > something. If someone has any direction or even demo code that would be<br>> > greatly appreciated.<br>> ><br>> > Thanks,<br>> ><br>> > Daniel<br>> ><br>> > -----Inline Attachment Follows-----<br>
> ><br>> > _______________________________________________<br>> > mapserver-users mailing list<br>> > <a href="http://mc/compose?to=mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><<a href="http://mc/compose?to=mapserver-users@lists.osgeo.org" target="_blank">http://mc/compose?to=mapserver-users@lists.osgeo.org</a>><br>
> > <a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>> ><br>> ><br>> ><br>> > _______________________________________________<br>
> > mapserver-users mailing list<br>> > <a href="http://mc/compose?to=mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>> > <a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
> ><br>> ><br><br>> _______________________________________________<br>> mapserver-users mailing
list<br>> <a href="http://mc/compose?to=mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>> <a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
<br>_______________________________________________<br>mapserver-users mailing list<br><a href="http://mc/compose?to=mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br><a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
</div></div></div></blockquote></td></tr></tbody></table></blockquote></div><br></div>