Visualizing Point Data

Bill Binko bill at BINKO.NET
Fri Feb 3 12:28:31 EST 2006


Hi all,

I'd like to thank everyone for their feedback on this, and remind our 
freinds meeting tomorrow just how valuable this community is in terms of 
responsiveness, accumen, and general ability.  Please make sure this 
community can continue to thrive with the new Foundation in the mix.

That said, I have some clarifying thoughts that I thought I'd post:

1) Bob Basques has found a link that describes the Kernel Density output 
very closely (thanks, Bob).  Here it is for background: 
http://www.quantdec.com/SYSEN597/GTKAV/section9/density.htm

2) Several people have mentioned grouping points and counting them, and 
then visualizing by the count.  I have used this technique two different 
ways, and I find use for both of them.  
	a) First, I have created arbitrary grids that split up a dataset
into blocks and then used the PostGIS Within() method to calculate 
count/sum/max/min/ave numbers for those blocks.
	b) I have used Census Block Group shapes and performed a similar 
calculation.  (This has the added benefit of being able to do "per capita" 
calculations.)

Both of these maps are useful: the Block Group map even has some "brains" 
behind it since the Block Groups have meaningful boundaries.  However, 
they are very easily skewed.  For example, a single large parcel of may 
take up a large percentage of the block, or points may be clustered very 
close to a corner -- this distributes the points across the blocks and 
dilutes their values.

3) Sean G suggested that a "poor man's" version of this could be created
with transparent shapes (which Mapserver doesn't yet support).  That's
true, to a point.  But there are problems with the approach.  For example,
unline a true density diagram, only the intensity of the color would
change: not the radius, so zoomed out views won't see highly dense
(coincident) areas

I'm not discounting any of these ideas: they all are helping, I just 
thought I'd post back a summary of what I've gotten so far.

Bill

PS: Here is the skeleton of a method in PostGIS that will create a new 
table with a grid that covers the extent of an existing dataset so that 
you can use "WITHIN" to gather averages, etc.

PL/PGSQL to create averages by area on a point set:

DECLARE
        source_table ALIAS FOR $1;
        source_col ALIAS for $2;
        dest_table ALIAS for $3;
        dest_col ALIAS for $4;
        num_cols ALIAS for $5;
        num_rows ALIAS for $6;

        srid integer;

        block_width double precision := 0;
        block_height double precision  := 0;
        border box3d;
        boxString text;
        result text;
BEGIN

        srid := select srid from geometry_columns where f_table_name ilike 
source_table and f_geometry_column ilike source_col;
        EXECUTE 'CREATE TABLE ' || dest_table || ' ( gid serial )';
        EXECUTE 'AddGeometryColumn('''||
                  dest_table||''','''||
                  dest_col||''',srid, ''POLYGON'',2)';

        border := box3d(extent(target_shape)) from target_table;
        block_width := (xmax(border) - xmin(border)) / num_cols;
        block_height := (ymax(border) - ymin(border))/ num_rows;
        boxString := 'BOX3D(''BOX3D(0 0 0, ' || block_width || ' ' || 
block_height || ' 0)'')';
        result := EXECUTE 'insert into  ' || dest_table || '( ' || 
dest_col || ') values ( '||  boxString ' ) ';
        return done;

end;



More information about the mapserver-users mailing list