How to do it...

The simplest way to convert point data to polygon data would be to buffer the points by their known separation:

ST_Buffer(the_geom, 5) 

We can imagine, however, that such a simplistic approach might look strange:

As such, it would be good to perform a union of these geometries in order to dissolve the internal boundaries:

ST_Union(ST_Buffer(the_geom, 5)) 

Now, we can see the start of some simple building footprints:

While this is marginally better, the result is quite lumpy. We will use the ST_Simplify_PreserveTopology function ...

Get PostGIS Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.