[geos-devel] Difference operation not always working as expected
Kevin Weller
kweller at asapwebsoft.com
Thu Nov 29 11:52:49 EST 2007
OK, WKT it is! Here ya go:
WORKING PRIMARY:
POLYGON ((1355.2556682087008539 2641.0482955551756277,
2675.2549625870647105 2642.4131547503075126, 2695.5193111868375127
3962.2575986814194948, 1375.5200168084738834 3960.8927394862880647,
1355.2556682087008539 2641.0482955551756277))
WORKING NEGATING:
POLYGON ((1700.4537532531219313 3631.2728433022930403,
1705.5198404030647907 3961.2339542850709222, 2035.5196639976556980
3961.5751690838537797, 2030.4535768477128386 3631.6140581010758979,
1700.4537532531219313 3631.2728433022930403))
WORKING RESULT:
POLYGON ((2035.5196639976556980 3961.5751690838537797,
2695.5193111868375127 3962.2575986814194948, 2675.2549625870647105
2642.4131547503075126, 1355.2556682087008539 2641.0482955551756277,
1375.5200168084738834 3960.8927394862880647, 1705.5198404030647907
3961.2339542850709222, 1700.4537532531219313 3631.2728433022930403,
2030.4535768477128386 3631.6140581010758979, 2035.5196639976556980
3961.5751690838537797))
BROKEN PRIMARY:
POLYGON ((1355.2556682087008539 2641.0482955551756277,
2675.2549625870647105 2642.4131547503075126, 2695.5193111868375127
3962.2575986814194948, 1375.5200168084738834 3960.8927394862880647,
1355.2556682087008539 2641.0482955551756277))
BROKEN NEGATING:
POLYGON ((2030.4535768477128386 3631.6140581010754431,
2035.5196639976556980 3961.5751690838537797, 2365.5194875922470601
3961.9163838826366373, 2360.4534004423039733 3631.9552728998587554,
2030.4535768477128386 3631.6140581010754431))
BROKEN RESULT:
POLYGON ((2035.5196639976556980 3961.5751690838537797,
2695.5193111868375127 3962.2575986814194948, 2675.2549625870647105
2642.4131547503075126, 1355.2556682087008539 2641.0482955551756277,
1375.5200168084738834 3960.8927394862880647, 2035.5196639976556980
3961.5751690838537797), (2035.5196639976556980 3961.5751690838537797,
2030.4535768477128386 3631.6140581010754431, 2360.4534004423039733
3631.9552728998587554, 2365.5194875922470601 3961.9163838826366373,
2035.5196639976556980 3961.5751690838537797))
- Kevin
On Nov 28, 2007, at 2:27 PM, Martin Davis wrote:
> Kevin,
>
> 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:
>> All,
>>
>> 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 at http://www.asapwebsoft.com/files/working_primary_and_negating_plot.png
>> and http://www.asapwebsoft.com/files/working_result_plot.png
>>
>> 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 http://www.asapwebsoft.com/files/test_output.txt
>>
>> 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
>> http://lists.osgeo.org/mailman/listinfo/geos-devel
>
> --
> Martin Davis
> Senior Technical Architect
> Refractions Research, Inc.
> (250) 383-3022
>
> _______________________________________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geos-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3818 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/geos-devel/attachments/20071129/1e67fe2a/smime.bin
More information about the geos-devel
mailing list