[geos-devel] Difference operation not always working as expected
mbdavis at refractions.net
Wed Nov 28 16:27:09 EST 2007
Please post the input and output WKT or WKB for your good and bad
cases. That's the only way we can attempt to debug this problem.
Kevin Weller wrote:
> Hopefully it's not merely due to my own idiocy, but I'm experiencing
> some weird results from difference and snap operations that may or may
> not imply GEOS3 bugs. I'm using the latest and greatest from trunk.
> Here's what I'm trying to do:
> I've got a smaller polygon (which I call the negating polygon) which
> partially covers a larger polygon (which I call the primary polygon).
> The negating polygon is always flush with one side or corner of the
> primary polygon. The goal is to subtract the negating polygon from
> the primary polygon such that there is a resulting "notch" in the
> primary. You can see an example of this actually working by looking
> http://www.asapwebsoft.com/files/working_primary_and_negating_plot.png and
> Sometimes, with only slightly different input (in this case, I move
> the negating polygon to the East), it doesn't work. See
> http://www.asapwebsoft.com/files/broken_primary_and_negating_plot.png and
> http://www.asapwebsoft.com/files/broken_result_plot.png (interior ring
> not shown on the plot, but I've checked, and it's there)
> In the latter case, instead of a notch in the resulting polygon, I get
> an interior ring (hole), even though the negating polygon is as close
> to overlapping as I can get it. I've even tried using the
> GeometrySnapper to snap the negating polygon to the primary polygon,
> in case they weren't quite lined up, but no luck. In fact, snapTo
> seems to have no effect for any of the inputs I provide, so the
> function must consider the polygon edges in question to be flush
> already. But I still get holes instead of notches.
> I'm scripting this in Ruby, and an excerpt from my Ruby driver code is
> at http://www.asapwebsoft.com/files/geos_client_code_excerpt.rb
> Also, the current output from geos_tests.rb (showing a handful of
> failures, probably not related, but I don't know that for sure) is at
> I'm not exactly sure what to try next, but I'm hoping that someone out
> there has some ideas.
> Oh, in the process of working on this, I've added the snapping
> features to the C API and the SWIG bindings...hopefully correctly.
> I'll be happy to share those changes if the community wants them.
> Since I'm not a committer, what would I do? Send patches to the list?
> - Kevin
> geos-devel mailing list
> geos-devel at lists.osgeo.org
Senior Technical Architect
Refractions Research, Inc.
More information about the geos-devel