[postgis-users] Exploding Polygons

Randall, Eric ERandall at eriecountygov.org
Tue Dec 2 14:27:31 PST 2008


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...,

Eric 



More information about the postgis-users mailing list