Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#41 Intersection of two Polygons producing incorrect results.

v1.0 (example)
open
nobody
None
5
2014-04-24
2013-08-26
mk
No

I am getting what I think to be incorrect results from the JTS library. Using the test builder, I put together the following test parameters:

Input A: POLYGON ((0 -108.88117080903034, 0 -250, -300 -250, -450 -350, -400 -100, -245.17261973193982 -61.29315493298495, -183.156003404559 -194.288217833639, 0 -108.88117080903034))
Input B: POLYGON ((-183.156003404559 -194.288217833639, 179.367111410101 -25.2409131373596, 10.3198067138211 337.2822016773, -352.203308100839 168.234896981021, -183.156003404559 -194.288217833639))

Geometry Function: Overlay->Intersection

Returned result: LINESTRING (-183.156003404559 -194.288217833639, 0 -108.88117080903034)

Expected result: MULTILINESTRING ((-245.17261973193982 -61.29315493298495, -183.156003404559 -194.288217833639), (-183.156003404559 -194.288217833639, 0 -108.88117080903034))

I am attaching an annotated screenshot of the test builder to illustrate the situation. When I do an intersection between the two, I would expect to get two line segments as the intersection but as you can see it only produces one line segment.

1 Attachments

Discussion

  • mk
    mk
    2013-08-29

    As a follow up, I think this is a similar iteration of the same problem: http://gis.stackexchange.com/questions/69995/jts-difference-op-followed-by-an-intersection-op-not-returning-expected-results

    Just as in the StackOverflow question, in the case for this report I am taking two overlapping polygons, doing a difference and then doing an intersection on the results. It all sounds like a rounding error to me - this seems to work better if all the edges are straight lines - but maybe there is something else going on.