[postgis-users] Buffer() Arc Tolerance

Martin Davis mbdavis at VividSolutions.com
Wed Oct 13 09:55:50 PDT 2004


JTS (and hence GEOS) provides two methods to compute buffers:

  public Geometry buffer(double distance)
  public Geometry buffer(double distance, int quadrantSegments)

The second method allows specifying the number of line segments which
are used to approximate a quadrant of a circle.  This allows the user to
choose any degree of accuracy of approximation they desire. (There's a
simple relationship between the number of segments and the maximum error
of distance in the approximation). 

As Paul says, the default is 8 segments - here's the documentation
explaining this choice from JTS:
  /**
   * The default number of facets into which to divide a fillet of 90
degrees.
   * A value of 8 gives less than 2% max error in the buffer distance.
   * For a max error of < 1%, use QS = 12
   */
  public static final int DEFAULT_QUADRANT_SEGMENTS = 8;

If PostGIS doesn't expose the buffer method allowing the accuracy to be
specified, perhaps it should be added?

Martin Davis, Senior Technical Architect
Vivid Solutions Inc.      www.vividsolutions.com
Suite #1A-2328 Government Street Victoria, B.C. V8T 5G5
Phone: (250) 385 6040 - Local 308 Fax: (250) 385 6046


> -----Original Message-----
> From: Paul Ramsey [mailto:pramsey at refractions.net] 
> Sent: October 13, 2004 9:33 AM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] Buffer() Arc Tolerance
> 
> 
> For nitty gritty the details, sometime you have to "use the 
> source, Luke".
> 
>  From PostGIS source:
> 
>      Geometry *g3 = g1->buffer(width);
> 
> So, PostGIS is not defining a stroke angle, or using anything 
> other than 
> the defaults, it's the GEOS code which is controlling what is done.
> 
> Hitting the GEOS code, source/operation/buffer is the place 
> to go, but 
> the documentation of DEFAULT_QUADRANT_SEGMENTS seems a bit 
> thin. I can 
> tell you that the default is 8, which is what PostGIS uses.
> 
> What do you mean by the arc tolerance? The number of vertices used to 
> approximate the circular structure?
> 
> Richard_D_Levine at Raytheon.com wrote:
> 
> > If I use Buffer() on a point to approximate a geodetic 
> circle, how do 
> > I determine the arc tolerance of the returned polygon to the circle?
> > 
> > Is there any documentation that contains answers to questions like 
> > this? I've read the PostGIS documentation cover to cover and the 
> > function explanations are at a very high level (mostly 
> copied from the 
> > OGC spec.)
> > 
> > Thanks,
> > 
> > Rick
> _______________________________________________
> 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