[postgis-users] Create polygon from buffered points

Martin Davis mbdavis at refractions.net
Wed Nov 14 16:32:37 PST 2007

Interesting problem...

I don't have an concrete answer or SQL to provide - but I have some 
helpful suggestions (as usual 8^)

Your use of buffer is not a problem - buffering points is fast.

Essentially what you are wanting to do is to compute the transitive 
closure of the "intersects" graph on the computed point buffers. One way 
to do this is to simply geomunion all the computed point buffers, and 
then split the result back into individual polygons. But this won't 
scale all that well (see the recent thread on the problems with unioning 
large numbers of polygons). Might be worth a try, though, especially if 
you can partition your data.

Failing that, you could compute the adjacency matrix of the graph 
implied by the intersects relationship, compute the transitive closure 
of this graph, and then group by this partioning and use geomunion on 
the result. Only one problem with this - you can't compute transitive 
closures in raw SQL. You need to use pgSQL and iterate over the graph. 
Here's a web page which discusses how to do this: 

Apologies if this is too techy to understand - perhaps there's some 
other people on the list who have some simpler ideas, or who can translate!

Little, John wrote:
> Hi there,
> I am new to this list (and to postgis). I'd really appreciate some 
> help with this problem (in my attempt to transfer this existing 
> process from ESRI to PostGIS).
> I have a table containing points (hpt_test) representing wildfire 
> hotspot locations, and I would like to create fire perimeter estimates 
> (polygons) using these point locations -- here are the steps I intend 
> to follow:
> 1) Buffer all points in table hpt_test (out 2000m) to produce polygons 
> (circles) -- to be inserted into table hpt_buf_test,
> 2) Dissolve where these circles overlap to create single buffer polygons.
> 3) Perform an inside buffer (in -1300m) on the result polygon produced 
> in step 2 -- this will help correct polygon shape.
> 4) Reproject (transform) to equal area projection (Albers-Canada) to 
> calculate area
> The desired result will be a table containing rough fire perimeter 
> estimates (fairly accurate on large size wildfires).
> Here is what I've done to prepare the buffer polygon table :
> CREATE TABLE cwfis_datamart.hpt_buf_test ( ID int4, NAME varchar(20) );
> AddGeometryColumn('cwfis_datamart','hpt_buf_test','the_geom',42304,'MULTIPOLYGON',2); 
> Now that I've got the table set up, I attempt to add buffer polygons 
> to the table (step 1 above):
> INSERT INTO cwfis_datamart.hpt_buf_test (ID, NAME, the_geom)
> VALUES (1,'First Geometry',(SELECT buffer(the_geom,2000)
> FROM cwfis_datamart.hpt_test));
> But this (of course) does not work... and I have scoured the archives 
> for clues but without success:( Please help me get started on this.
> I am aware that buffer is "a very expensive" process, but I can't 
> think of an alternative. My test point table is very small, but in 
> reality this would be a fairly large table, so I will likely need to 
> break this up by region… If anyone can help me out with the sql, point 
> me to helpful resources, or suggest a better alternative, please advise :)
> Thanks!
> John Little
> _http://cwfis.cfs.nrcan.gc.ca/_
> ------------------------------------------------------------------------
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users

Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022

More information about the postgis-users mailing list