[postgis-users] ST_Buffer() never returns
Andi Vajda
vajda at metaweb.com
Tue Sep 23 20:40:43 PDT 2008
On Fri, 12 Sep 2008, Martin Davis wrote:
> This is an example of a known issue with GEOS/JTS buffering. The problem
> occurs when using a relatively large buffer distance on geometries which have
> a large number of vertices which are relatively dense (i.e. the distance
> between adjacent vertices is much smaller than the requested buffer
> distance).
>
> A couple of ways to avoid this problem are:
> - simplify the input geometry using a tolerance which gets rid of most of the
> very dense vertices (use a tolerance of say from 1% to 10% of the buffer
> distance)
> - buffer the geometry mulitple times, starting with a very small buffer
> distance and gradually increasing it
Thanks, with your tip, I defined the following function which made it
work (and fast) for all the shapes in my db:
CREATE OR REPLACE FUNCTION gix_make_shell(geometry)
RETURNS geometry AS $$
SELECT ST_Simplify(ST_Buffer(ST_Simplify(ST_Buffer(ST_Simplify(ST_Buffer(ST_Simplify(ST_Buffer($1,
0.0001), 0.0001), 0.001), 0.001), 0.01), 0.01), 0.1), 0.1)
$$ LANGUAGE SQL STABLE;
Andi..
More information about the postgis-users
mailing list