[postgis-users] Exploding Polygons

Carl Anderson carl.anderson at vadose.org
Tue Dec 2 17:45:01 PST 2008


Have you considered subtracting a buffer around the boundary of each 
polygon from itself.  Kind of similar to st_buffer with a negative 
distance but a good bit more stable.

st_difference(geom,st_buffer(st_boundary(geom),100))) from mypolytable ;

st_buffer(geom,-X) will work until X gets large enough to start to get 
collapsing geometries and then you will get
    ERROR:  getPoint2d_p: point offset out of range


C.


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...,
>
> Eric 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>   




More information about the postgis-users mailing list