[postgis-users] Exploding Polygons

Stephen Woodbridge woodbri at swoodbridge.com
Tue Dec 2 14:43:27 PST 2008


Randall, Eric wrote:
> Hi all,
> 
> I'm trying to figure out how to explode a set of polygons to display
> them with space between.  In my case they are municipal boundary
> polys but could be anything.  So far the only approach I can think of
> is using translate such that:
> 
> select st_translate(st_translate(poly, -x(st_centroid(poly)),
> -y(st_centroid(poly))),x(p2) + (x(p2)- x(p1)), y(p2) + (y(p2) -
> y(p1))) from (select st_centroid(st_collect(geom))as p1 from
> mypolytable) as s1, (select st_centroid(geom) as p2, geom as poly
> from mypolytable) as s2
> 
> 
> The problem with this is that small polys (Boroughs, etc) relative
> larger ones often don't get their own space until a large enough
> multiplier is applied, i.e.   x(p2) + (x(p2)- x(p1))*5, y(p2) +
> (y(p2) - y(p1))*5 ,  but then there is too much space around the
> larger polys.
> 
> Anyone have a suggestion or done this another way?  Thanks.
> 
> 
> 
> think i'm gonna splode...,

I'm not sure if it will work, but have you tried doing a buffer with a 
negative distance.

select st_buffer(the_geom, -100) from table;

where -100 is whatever distance you want the edge to be retracted. This 
would be in the units of the table.

-Steve



More information about the postgis-users mailing list