[postgis-users] spatial distribution maps (heat maps?)

Puneet Kishor punk.kish at gmail.com
Mon Dec 5 17:54:48 PST 2011


Steve,

Thanks for your reply.


On Dec 5, 2011, at 6:52 PM, Stephen Woodbridge wrote:

> On 12/5/2011 6:45 PM, Puneet Kishor wrote:
>> I am looking to create some heatmap-ish or DEM-ish spatial
>> distribution visualizations. Any suggestions on how to go about doing
>> so given a lon-lat containing geom column in PostGIS?
> 
> ..
> 
> Create an empty raster. Then select your points and for each points and for each one "add" the sample dot centered on your location to to the raster. By "add", I mean you need to add the value of the pixels in the dot to the pixels in the raster. So raster=1 + dot=3 => raster=4 and limit it at maximum saturation. This should work for multiple channels also. This should give you a heat map.
> 


Reading the above made me realize that I should have rephrased my question -- I don't want to create images on the server side. I realize now that what I really want to do is to do spatial clustering on the server side and then send the data to the browser. I wrote my own very naive clustering routine in Perl, and also tried Algorithm::KMeans [1]. This kind of analysis allows me to create a summary of my data that I can then plot on the client (see image at [2]).

Of course, my algorithm is way too naive, and waaaaay too slow, although I *can* compute the summary and cache it using Storable.

So, here is my rephrased question -- I am looking to do spatial clustering on my Pg data. The added complication is that I do not have access to WKTRaster.


[1] http://search.cpan.org/~avikak/Algorithm-KMeans-1.30/lib/Algorithm/KMeans.pm
[2] http://dl.dropbox.com/u/3526821/occurrences.png


More information about the postgis-users mailing list