[geos-devel] BUFFER(0): JTS and GEOS difference

Martin Davis mbdavis at VividSolutions.com
Thu Aug 4 18:27:25 EDT 2005


The fact that JTS causes the "hole" to disappear I think is due to the
"hole" actually being an overlap, where the polygon loops around on top
of itself.  Although this displays as a hole in JUMP, this is just an
artifact of the rendering strategy used.  For cases like this buffer(0)
correctly (IMO) eliminates the hole.

(It would be useful to have an API which "fixes" polygons of this type,
together with ones with inversions (SDE-style).  I actually have code to
do this, I just have to build it into JTS...)

The difference in GEOS *may* be due to a fix introduced in JTS 1.5,
which eliminated a bug causing some holes to be dropped in buffers.

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: geos-devel-bounces at geos.refractions.net 
> [mailto:geos-devel-bounces at geos.refractions.net] On Behalf Of 
> dblasby at openplans.org
> Sent: August 4, 2005 10:07 AM
> To: geos-devel at geos.refractions.net
> Cc: jts-devel at lists.jump-project.org
> Subject: [geos-devel] BUFFER(0): JTS and GEOS difference
> 
> 
> I ran a buffer(0) on this polygon and got two different results.
> 
> NOTE: this polygon is invalid -- the outside ring touches 
> itself at -73.77333305098847, 40.860510652289854.  This 
> should actually be hole in the polygon.  (see picture)
> 
> When I run buffer(0) in JTS, I get the original polygon back 
> but the "hole" disappears. (see picture)
> 
> When I run buffer(0) in GEOS, ALL the holes disappear. (see picture)
> 
> The polygon is invalid, so I'm not sure if you want to call 
> this a bug. 
> I'm surprised that they give different results and maybe 
> showing an issue in GEOS.
> 
> I'm using the GEOS in: postgis-setup-1.0.0-1.exe.
> 
> dave
> 
> 
> 
> 
> POLYGON ((-73.78343 40.873622999999995, -73.784576 40.877131, 
> -73.784402 40.878178, -73.784803 40.878527999999996, 
> -73.783222 40.880963, -73.781202 40.880478, -73.760988 
> 40.875178, -73.749483 40.872101, -73.748077 40.871725, 
> -73.74806 40.871721,
>     -73.753732 40.856556, -73.77080099999999 40.860279, 
> -73.773301 40.860479, -73.773601 40.861079, -73.773201 
> 40.861379, -73.773001 40.860979, -73.773301 40.860479, 
> -73.781005 40.861339, -73.785297 40.861373, -73.787268 40.860848,
>     -73.787899 40.860493999999996, -73.791702 40.860979, 
> -73.79010199999999 40.867878999999995, -73.785502 40.869079, 
> -73.783602 40.870279, -73.783002 40.872178, -73.783902 
> 40.872778, -73.783002 40.873377999999995, -73.78343 
> 40.873622999999995),
>   (-73.781702 40.875478, -73.781402 40.875578, -73.781502 
> 40.875778, -73.781702 40.875678, -73.781702 40.875478),
>   (-73.780402 40.876478, -73.780502 40.876778, -73.780802 
> 40.876577999999995, -73.78070199999999 40.876377999999995, 
> -73.780402 40.876478),
>   (-73.76650099999999 40.867179, -73.766001 40.867579, 
> -73.76690099999999 40.867979, -73.767201 40.867278999999996, 
> -73.76650099999999 40.867179),
>   (-73.769401 40.865379, -73.769201 40.865778999999996, 
> -73.769701 40.865778999999996, -73.769801 40.865379, 
> -73.769401 40.865379),
>   (-73.769201 40.870979, -73.770101 40.871978999999996, 
> -73.771501 40.872378999999995, -73.77210099999999 40.872079, 
> -73.77040099999999 40.871078999999995, -73.769201 40.870979),
>   (-73.774402 40.861579, -73.774502 40.862079, -73.775302 
> 40.861979, -73.775502 40.861379, -73.774402 40.861579),
>   (-73.783802 40.862879, -73.78460199999999 40.863079, 
> -73.784502 40.862679, -73.783802 40.862879),
>   (-73.785202 40.863979, -73.785702 40.863979, 
> -73.78540199999999 40.863378999999995, -73.785202 40.863979))
> 
> 
> 
> 
> 
> ----------------------------------------------------------
> This mail sent through IMP: https://webmail.limegroup.com/
> 



More information about the geos-devel mailing list