diff --git a/NEWS.md b/NEWS.md index a77954ff6e..dceea6da58 100644 --- a/NEWS.md +++ b/NEWS.md @@ -21,6 +21,8 @@ - Breaking Changes: - BufferOp returns POLYGON EMPTY when fed Inf/Nan coords (GH-1332) - Return Inf when calculating distance to an empty geometry (GH-1345, Even Rouault) + - Overlay operations now produce a LineString geometry in cases that would previously + produce a MultiLineString with contiguous sub-geometries. (GH-1459, Dan Baston) - Fixes/Improvements: diff --git a/src/operation/overlayng/LineBuilder.cpp b/src/operation/overlayng/LineBuilder.cpp index 4d1a258778..27c8bf1a13 100644 --- a/src/operation/overlayng/LineBuilder.cpp +++ b/src/operation/overlayng/LineBuilder.cpp @@ -35,7 +35,7 @@ std::vector> LineBuilder::getLines() { markResultLines(); - addResultLines(); + addResultLinesMerged(); // Transfer ownership of all the lines to the // caller @@ -252,10 +252,10 @@ LineBuilder::buildLine(OverlayEdge* node) const const bool constructZ = node->getCoordinatesRO()->hasZ(); const bool constructM = node->getCoordinatesRO()->hasM(); geom::util::CurveBuilder cb(*geometryFactory, constructZ, constructM); + cb.setOutputLinearRing(false); // assert: edgeStart degree = 1 // assert: edgeStart direction = forward - cb.add(*node->getCoordinatesRO(), node->isCurved()); bool isNodeForward = node->isForward(); diff --git a/tests/unit/capi/GEOSDifferenceTest.cpp b/tests/unit/capi/GEOSDifferenceTest.cpp index ee1e8c8231..18149a08d8 100644 --- a/tests/unit/capi/GEOSDifferenceTest.cpp +++ b/tests/unit/capi/GEOSDifferenceTest.cpp @@ -73,7 +73,7 @@ void object::test<3>() result_ = GEOSDifference(geom1_, geom2_); ensure(result_); - expected_ = fromWKT("MULTICURVE (CIRCULARSTRING (1.7071067812 0.7071067812, 1.9238795325 0.3826834324, 2 0), CIRCULARSTRING (0 0, 0.6173165676 0.9238795325, 1.7071067812 0.7071067812))"); + expected_ = fromWKT("CIRCULARSTRING (0 0, 0.6173165676 0.9238795325, 1.7071067812 0.7071067812, 1.9238795325 0.3826834324, 2 0)"); ensure_geometry_equals(result_, expected_, 1e-8); } diff --git a/tests/unit/operation/geounion/UnaryUnionOpTest.cpp b/tests/unit/operation/geounion/UnaryUnionOpTest.cpp index 7809073826..9f2023e39f 100644 --- a/tests/unit/operation/geounion/UnaryUnionOpTest.cpp +++ b/tests/unit/operation/geounion/UnaryUnionOpTest.cpp @@ -78,6 +78,7 @@ struct test_unaryuniontest_data { GeomPtr b2 = normalize(b); bool eq = a2->equalsExact(b2.get()); if(! eq) { + cout << "EXPECTED: " << wktwriter.write(a2.get()) << endl; cout << "OBTAINED: " << wktwriter.write(b2.get()) << endl; } return eq; @@ -184,6 +185,8 @@ template<> void object::test<6> () { + set_test_name("non-simple LineString"); + static char const* const geoms[] = { "LINESTRING (0 0, 10 0, 5 -5, 5 5)", nullptr diff --git a/tests/unit/operation/overlayng/CoverageUnionNGTest.cpp b/tests/unit/operation/overlayng/CoverageUnionNGTest.cpp index 01095d0f5f..49db51c2f5 100644 --- a/tests/unit/operation/overlayng/CoverageUnionNGTest.cpp +++ b/tests/unit/operation/overlayng/CoverageUnionNGTest.cpp @@ -157,7 +157,7 @@ void object::test<9> () { checkUnion( "MULTILINESTRING ((1 1, 5 1), (9 1, 5 1))", - "MULTILINESTRING ((1 1, 5 1), (5 1, 9 1))"); + "LINESTRING (1 1, 5 1, 9 1)"); } /** @@ -169,7 +169,7 @@ void object::test<10> () { checkUnion( "MULTILINESTRING ((1 1, 2 1, 3 1), (4 1, 3 1, 2 1))", - "MULTILINESTRING ((1 1, 2 1), (2 1, 3 1), (3 1, 4 1))"); + "LINESTRING (1 1, 2 1, 3 1, 4 1)"); } /** @@ -181,27 +181,29 @@ void object::test<11> () { checkUnion( "MULTILINESTRING ((1 9, 3.1 8, 5 7, 7 8, 9 9), (5 7, 5 3, 4 3, 2 3), (9 5, 7 4, 5 3, 8 1))", - "MULTILINESTRING ((1 9, 3.1 8), (2 3, 4 3), (3.1 8, 5 7), (4 3, 5 3), (5 3, 5 7), (5 3, 7 4), (5 3, 8 1), (5 7, 7 8), (7 4, 9 5), (7 8, 9 9))"); + "MULTILINESTRING ((1 9, 3.1 8, 5 7), (2 3, 4 3, 5 3), (5 3, 5 7), (5 3, 7 4, 9 5), (5 3, 8 1), (5 7, 7 8, 9 9))"); } -// Z values preserved in linear inpuuts +// Z values preserved in linear inputs template<> template<> void object::test<12> () { + // TODO: Should Z values be averaged? checkUnion( "MULTILINESTRING Z ((1 1 8, 5 1 9), (9 1 6, 5 1 2))", - "MULTILINESTRING Z ((1 1 8, 5 1 9), (5 1 2, 9 1 6))"); + "LINESTRING Z (1 1 8, 5 1 9, 9 1 6)"); } -// M values preserved in linear inpuuts +// M values preserved in linear inputs template<> template<> void object::test<13> () { + // TODO: Should M values be averaged? checkUnion( "MULTILINESTRING M ((1 1 8, 5 1 9), (9 1 6, 5 1 2))", - "MULTILINESTRING M ((1 1 8, 5 1 9), (5 1 2, 9 1 6))"); + "LINESTRING M (1 1 8, 5 1 9, 9 1 6)"); } // Mixed Z/M values handled in linear inputs @@ -210,8 +212,9 @@ template<> template<> void object::test<14>() { + // TODO: Should M values be coalesced? checkUnion("GEOMETRYCOLLECTION (LINESTRING Z(1 1 8, 5 1 9), LINESTRING M(9 1 6, 5 1 2))", - "MULTILINESTRING ZM ((1 1 8 NaN, 5 1 9 NaN), (5 1 9 2, 9 1 8.5 6))"); + "LINESTRING ZM (1 1 8 NaN, 5 1 9 NaN, 9 1 8.5 6)"); } // Z values preserved in polygonal inputs diff --git a/tests/unit/operation/overlayng/OverlayNGGeometryCollectionTest.cpp b/tests/unit/operation/overlayng/OverlayNGGeometryCollectionTest.cpp index 3edf40cce2..9eb04234dc 100644 --- a/tests/unit/operation/overlayng/OverlayNGGeometryCollectionTest.cpp +++ b/tests/unit/operation/overlayng/OverlayNGGeometryCollectionTest.cpp @@ -131,10 +131,12 @@ template<> template<> void object::test<6> () { + set_test_name("testSimpleL_AA"); + std::string a = "LINESTRING (0 0, 10 10)"; std::string b = "GEOMETRYCOLLECTION ( POLYGON ((1 1, 1 5, 5 5, 5 1, 1 1)), POLYGON ((9 9, 9 5, 5 5, 5 9, 9 9)) )"; testIntersection(a, b, - "MULTILINESTRING ((1 1, 5 5), (5 5, 9 9))"); + "LINESTRING (1 1, 5 5, 9 9)"); testUnion(a, b, "GEOMETRYCOLLECTION (LINESTRING (0 0, 1 1), LINESTRING (9 9, 10 10), POLYGON ((1 1, 1 5, 5 5, 5 1, 1 1)), POLYGON ((5 5, 5 9, 9 9, 9 5, 5 5)))"); } diff --git a/tests/unit/operation/overlayng/OverlayNGTest.cpp b/tests/unit/operation/overlayng/OverlayNGTest.cpp index 2da3cbccaa..0240fa4576 100644 --- a/tests/unit/operation/overlayng/OverlayNGTest.cpp +++ b/tests/unit/operation/overlayng/OverlayNGTest.cpp @@ -234,10 +234,12 @@ template<> template<> void object::test<13> () { + set_test_name("testAreaLineIntersection"); + std::string a = "POLYGON ((360 200, 220 200, 220 180, 300 180, 300 160, 300 140, 360 200))"; std::string b = "MULTIPOLYGON (((280 180, 280 160, 300 160, 300 180, 280 180)), ((220 230, 240 230, 240 180, 220 180, 220 230)))"; // std::string exp = "POLYGON ((220 200, 240 200, 240 180, 220 180, 220 200))"; - std::string exp = "GEOMETRYCOLLECTION (LINESTRING (280 180, 300 180), LINESTRING (300 160, 300 180), POLYGON ((220 180, 220 200, 240 200, 240 180, 220 180)))"; + std::string exp = "GEOMETRYCOLLECTION (LINESTRING (280 180, 300 180, 300 160), POLYGON ((220 180, 220 200, 240 200, 240 180, 220 180)))"; testOverlay(a, b, exp, OverlayNG::INTERSECTION, 1); } @@ -500,9 +502,11 @@ template<> template<> void object::test<37> () { + set_test_name("testCollapseTriBoxUnion"); + std::string a = "POLYGON ((1 3.3, 1.3 1.4, 3.1 1.4, 3.1 0.9, 1.3 0.9, 1 -0.2, 0.8 1.3, 1 3.3))"; std::string b = "POLYGON ((1 2.9, 2.9 2.9, 2.9 1.3, 1.7 1, 1.3 0.9, 1 0.4, 1 2.9))"; - std::string exp = "MULTILINESTRING ((1 1, 1 0), (1 3, 1 1), (1 1, 2 1), (2 1, 3 1))"; + std::string exp = "MULTILINESTRING ((1 1, 1 0), (1 3, 1 1), (1 1, 2 1, 3 1))"; testOverlay(a, b, exp, OverlayNG::INTERSECTION, 1); } @@ -808,9 +812,7 @@ void object::test<62>() std::string a = "CIRCULARSTRING (0 0, 1 1, 2 0, 3 -1, 4 0)"; - // Noding causes the CircularString to split at (2, 0) - // OverlayNG does not merge output lines, so we get a MultiCurve. - std::string exp = "MULTICURVE (CIRCULARSTRING (0 0, 1 1, 2 0), CIRCULARSTRING (2 0, 3 -1, 4 0))"; + std::string exp = "CIRCULARSTRING (0 0, 1 1, 2 0, 3 -1, 4 0)"; testOverlay(a, a, exp, OverlayNG::UNION, 0); } diff --git a/tests/unit/operation/overlayng/OverlayNGZTest.cpp b/tests/unit/operation/overlayng/OverlayNGZTest.cpp index d8625d3cb8..7eb79756c5 100644 --- a/tests/unit/operation/overlayng/OverlayNGZTest.cpp +++ b/tests/unit/operation/overlayng/OverlayNGZTest.cpp @@ -129,11 +129,13 @@ template<> template<> void object::test<5> () { + set_test_name("testLineOverlapUnion"); + checkUnion("LINESTRING (0 0 0, 10 10 10)", "LINESTRING (5 5 990, 15 15 999)", - "MULTILINESTRING Z((0 0 0, 5 5 990), (5 5 990, 10 10 10), (10 10 10, 15 15 999))"); + "LINESTRING Z(0 0 0, 5 5 990, 10 10 10, 15 15 999)"); checkUnion("LINESTRING M (0 0 0, 10 10 10)", "LINESTRING M (5 5 990, 15 15 999)", - "MULTILINESTRING M((0 0 0, 5 5 990), (5 5 990, 10 10 10), (10 10 10, 15 15 999))"); + "LINESTRING M(0 0 0, 5 5 990, 10 10 10, 15 15 999)"); } // testLineLineXYDifferenceLineInterpolated diff --git a/tests/unit/operation/overlayng/PrecisionReducerTest.cpp b/tests/unit/operation/overlayng/PrecisionReducerTest.cpp index 7d9dc6ea0c..8953a9dd2c 100644 --- a/tests/unit/operation/overlayng/PrecisionReducerTest.cpp +++ b/tests/unit/operation/overlayng/PrecisionReducerTest.cpp @@ -159,8 +159,10 @@ template<> template<> void object::test<13> () { + set_test_name("testCollapsedNodedLine"); + checkReduce("LINESTRING(1 1, 3 3, 9 9, 5.1 5, 2.1 2)", - 1, "MULTILINESTRING ((1 1, 2 2), (2 2, 3 3), (3 3, 5 5), (5 5, 9 9))"); + 1, "LINESTRING (1 1, 2 2, 3 3, 5 5, 9 9)"); } // diff --git a/tests/unit/operation/sharedpaths/SharedPathsOpTest.cpp b/tests/unit/operation/sharedpaths/SharedPathsOpTest.cpp index ded1c83fcf..78f6e99368 100644 --- a/tests/unit/operation/sharedpaths/SharedPathsOpTest.cpp +++ b/tests/unit/operation/sharedpaths/SharedPathsOpTest.cpp @@ -324,9 +324,8 @@ void object::test<16> forwDir.clear(); backDir.clear(); SharedPathsOp::sharedPathsOp(*g0, *g1, forwDir, backDir); - ensure_equals(forwDir.size(), 2u); - ensure_equals(wktwriter.write(forwDir[0]), "LINESTRING (0 0, 5 10)"); - ensure_equals(wktwriter.write(forwDir[1]), "LINESTRING (5 10, 10 10)"); + ensure_equals(forwDir.size(), 1u); + ensure_equals(wktwriter.write(forwDir[0]), "LINESTRING (0 0, 5 10, 10 10)"); SharedPathsOp::clearEdges(forwDir); ensure(backDir.empty()); @@ -343,9 +342,8 @@ void object::test<17> forwDir.clear(); backDir.clear(); SharedPathsOp::sharedPathsOp(*g0, *g1, forwDir, backDir); - ensure_equals(backDir.size(), 2u); - ensure_equals(wktwriter.write(backDir[0]), "LINESTRING (0 0, 5 10)"); - ensure_equals(wktwriter.write(backDir[1]), "LINESTRING (5 10, 10 10)"); + ensure_equals(backDir.size(), 1u); + ensure_equals(wktwriter.write(backDir[0]), "LINESTRING (0 0, 5 10, 10 10)"); SharedPathsOp::clearEdges(backDir); ensure(forwDir.empty()); diff --git a/tests/xmltester/XMLTester.cpp b/tests/xmltester/XMLTester.cpp index be54458132..01803404b7 100644 --- a/tests/xmltester/XMLTester.cpp +++ b/tests/xmltester/XMLTester.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -1395,6 +1396,10 @@ void Test::executeOp(Geometry* gA, Geometry* gB) double tolerance = std::atof(opArg2.c_str()); checkResult( *geos::simplify::TopologyPreservingSimplifier::simplify(gA, tolerance) ); } + else if (opName == "split") + { + checkResult(*geos::operation::split::GeometrySplitter::split(*gA, *gB)); + } else { //TODO: error out here? std::cerr << tester.testcaseRef() << " - " << opName; diff --git a/tests/xmltester/tests/general/TestNGOverlayA.xml b/tests/xmltester/tests/general/TestNGOverlayA.xml index 3d981d4818..7c9089c67e 100644 --- a/tests/xmltester/tests/general/TestNGOverlayA.xml +++ b/tests/xmltester/tests/general/TestNGOverlayA.xml @@ -259,7 +259,7 @@ Uses a floating precision model. - MULTILINESTRING ((27 27, 27 13), (27 13, 13 13), (13 27, 27 27), (13 13, 13 27)) + LINESTRING (13 13, 13 27, 27 27, 27 13, 13 13) @@ -482,8 +482,7 @@ POLYGON ((13 27, 27 27, 27 13, 13 13, 13 27), (15 25, 20 25, 20 20, 15 20, 15 25 GEOMETRYCOLLECTION (POLYGON ((22 22, 27 22, 27 20, 20 20, 20 25, 20 27, 22 27, 22 22)), POLYGON ((15 20, 20 20, 20 13, 15 13, 15 15, 13 15, 13 20, 15 20)), - LINESTRING (22 27, 27 27), - LINESTRING (27 27, 27 22)) + LINESTRING (22 27, 27 27, 27 22)) diff --git a/tests/xmltester/tests/general/TestNGOverlayAPrec.xml b/tests/xmltester/tests/general/TestNGOverlayAPrec.xml index e20a8edd1f..0eb8934f12 100644 --- a/tests/xmltester/tests/general/TestNGOverlayAPrec.xml +++ b/tests/xmltester/tests/general/TestNGOverlayAPrec.xml @@ -67,10 +67,9 @@ POLYGON ((1 3.3, 1.3 1.4, 3.1 1.4, 3.1 0.9, 1.3 0.9, 1 -0.2, 0.8 1.3, 1 3.3)) POLYGON ((1 2.9, 2.9 2.9, 2.9 1.3, 1.7 1, 1.3 0.9, 1 0.4, 1 2.9)) -MULTILINESTRING ((1 1, 2 1), +MULTILINESTRING ((1 1, 2 1, 3 1), (1 1, 1 0), - (1 3, 1 1), - (2 1, 3 1)) + (1 3, 1 1)) GEOMETRYCOLLECTION (POLYGON ((1 1, 1 3, 3 3, 3 1, 2 1, 1 1)), @@ -307,10 +306,10 @@ POLYGON ((1 1, 1 4, 3 4, 3 1.3, 7 1, 1 1)) POLYGON ((8 4, 9 4, 9 1, 4 1, 8 1.3, 8 4)) -MULTILINESTRING ((6 1, 7 1), (4 1, 6 1)) +LINESTRING (4 1, 6 1, 7 1) -GEOMETRYCOLLECTION (POLYGON ((9 4, 9 1, 8 1, 8 4, 9 4)), POLYGON ((1 4, 3 4, 3 1, 1 1, 1 4)), LINESTRING (8 1, 7 1), LINESTRING (6 1, 7 1), LINESTRING (3 1, 4 1), LINESTRING (4 1, 6 1)) +GEOMETRYCOLLECTION (POLYGON ((9 4, 9 1, 8 1, 8 4, 9 4)), POLYGON ((1 4, 3 4, 3 1, 1 1, 1 4)), LINESTRING (3 1, 4 1, 6 1, 7 1, 8 1)) GEOMETRYCOLLECTION (POLYGON ((1 4, 3 4, 3 1, 1 1, 1 4)), LINESTRING (3 1, 4 1)) @@ -323,4 +322,4 @@ GEOMETRYCOLLECTION (POLYGON ((9 4, 9 1, 8 1, 8 4, 9 4)), POLYGON ((1 4, 3 4, 3 1 - \ No newline at end of file + diff --git a/tests/xmltester/tests/general/TestNGOverlayGC.xml b/tests/xmltester/tests/general/TestNGOverlayGC.xml index d50eb44c71..1dd39b37d5 100644 --- a/tests/xmltester/tests/general/TestNGOverlayGC.xml +++ b/tests/xmltester/tests/general/TestNGOverlayGC.xml @@ -74,7 +74,7 @@ Uses a floating precision model. - MULTILINESTRING ((1 1, 5 5), (5 5, 9 9)) + LINESTRING (1 1, 5 5, 9 9) diff --git a/tests/xmltester/tests/general/TestNGOverlayL.xml b/tests/xmltester/tests/general/TestNGOverlayL.xml index 4ec2faba4f..1db4001d4e 100644 --- a/tests/xmltester/tests/general/TestNGOverlayL.xml +++ b/tests/xmltester/tests/general/TestNGOverlayL.xml @@ -44,10 +44,10 @@ POINT (15 15) MULTILINESTRING ((10 10, 15 15), (15 15, 20 20), (10 20, 15 15), (15 15, 20 10)) -MULTILINESTRING ((10 10, 15 15), (15 15, 20 20)) +LINESTRING (10 10, 15 15, 20 20) -MULTILINESTRING ((10 20, 15 15), (15 15, 20 10)) +LINESTRING (10 20, 15 15, 20 10) MULTILINESTRING ((10 10, 15 15), (15 15, 20 20), (10 20, 15 15), (15 15, 20 10)) @@ -75,7 +75,7 @@ LINESTRING (10 10, 20 20) LINESTRING (20 20, 30 30) -MULTILINESTRING ((20 20, 30 30), (10 10, 20 20)) +LINESTRING (10 10, 20 20, 30 30) @@ -150,7 +150,7 @@ MULTILINESTRING ((0 10, 10 10, 20 20), (30 30, 40 30)) MULTILINESTRING ((20 0, 20 20), (30 30, 30 40)) -MULTILINESTRING ((0 10, 10 10, 20 20), (20 0, 20 20), (30 30, 30 40), (30 30, 40 30)) +MULTILINESTRING ((0 10, 10 10, 20 20, 20 0), (40 30, 30 30, 30 40)) @@ -169,13 +169,13 @@ GEOMETRYCOLLECTION (LINESTRING (0 0, 3 3), POINT (5 5)) MULTILINESTRING ((5 5, 1 9), (0 0, 3 3), (5 5, 10 10), (3 3, 8 2, 5 5), (3 3, 5 5)) -MULTILINESTRING ((5 5, 10 10), (3 3, 5 5)) +LINESTRING (3 3, 5 5, 10 10) -MULTILINESTRING ((5 5, 1 9), (3 3, 8 2, 5 5)) +LINESTRING (3 3, 8 2, 5 5, 1 9) -MULTILINESTRING ((5 5, 1 9), (5 5, 10 10), (3 3, 8 2, 5 5), (3 3, 5 5)) +MULTILINESTRING ((5 5, 1 9), (5 5, 10 10), (5 5, 3 3, 8 2, 5 5)) @@ -194,10 +194,10 @@ POINT (150 150) MULTILINESTRING ((150 150, 200 200, 300 300, 400 200), (100 100, 150 150), (190 110, 150 150), (150 150, 120 180)) -MULTILINESTRING ((150 150, 200 200, 300 300, 400 200), (100 100, 150 150)) +LINESTRING (100 100, 150 150, 200 200, 300 300, 400 200) -MULTILINESTRING ((190 110, 150 150), (150 150, 120 180)) +LINESTRING (190 110, 150 150, 120 180) MULTILINESTRING ((150 150, 200 200, 300 300, 400 200), (100 100, 150 150), (190 110, 150 150), (150 150, 120 180)) diff --git a/tests/xmltester/tests/general/TestNGOverlayLPrec.xml b/tests/xmltester/tests/general/TestNGOverlayLPrec.xml index 99ec16f037..70dabbf808 100644 --- a/tests/xmltester/tests/general/TestNGOverlayLPrec.xml +++ b/tests/xmltester/tests/general/TestNGOverlayLPrec.xml @@ -22,10 +22,10 @@ MULTIPOINT ((2 2), (3 3)) MULTILINESTRING ((1 1, 2 2), (2 2, 3 3), (3 3, 4 4), (2 2, 4 2), (3 1, 2 2), (3 4, 3 3), (3 3, 1 3)) -MULTILINESTRING ((1 1, 2 2), (2 2, 3 3), (3 3, 4 4)) +LINESTRING (1 1, 2 2, 3 3, 4 4) -MULTILINESTRING ((2 2, 4 2), (3 1, 2 2), (3 4, 3 3), (3 3, 1 3)) +MULTILINESTRING ((3 1, 2 2, 4 2), (3 4, 3 3, 1 3)) MULTILINESTRING ((1 1, 2 2), (2 2, 3 3), (3 3, 4 4), (2 2, 4 2), (3 1, 2 2), (3 4, 3 3), (3 3, 1 3)) @@ -41,10 +41,10 @@ LINESTRING (1.1 1.3, 2.6 2.8, 3.8 3.3) LINESTRING (0.3 2.8, 1.4 1.9, 2.7 2.6, 2.9 3.8) -MULTILINESTRING ((1 2, 2 2), (2 2, 3 3)) +LINESTRING (1 2, 2 2, 3 3) -MULTILINESTRING ((1 1, 1 2), (1 2, 2 2), (2 2, 3 3), (3 3, 4 3), (0 3, 1 2), (3 3, 3 4)) +MULTILINESTRING ((1 1, 1 2), (1 2, 2 2, 3 3), (3 3, 4 3), (0 3, 1 2), (3 3, 3 4)) MULTILINESTRING ((1 1, 1 2), (3 3, 4 3)) @@ -53,7 +53,7 @@ MULTILINESTRING ((1 1, 1 2), (3 3, 4 3)) MULTILINESTRING ((0 3, 1 2), (3 3, 3 4)) -MULTILINESTRING ((1 1, 1 2), (3 3, 4 3), (0 3, 1 2), (3 3, 3 4)) +MULTILINESTRING ((1 1, 1 2, 0 3), (3 4, 3 3, 4 3)) @@ -66,10 +66,10 @@ LINESTRING (0 0, 1.8 2.3, 1.1 1.1, 3 3) LINESTRING (0.7 0.7, 2.8 2.6) -MULTILINESTRING ((1 1, 2 2), (2 2, 3 3)) +LINESTRING (1 1, 2 2, 3 3) -MULTILINESTRING ((0 0, 1 1), (1 1, 2 2), (2 2, 3 3)) +LINESTRING (0 0, 1 1, 2 2, 3 3) LINESTRING (0 0, 1 1) @@ -91,10 +91,10 @@ LINESTRING (0 1, 0.9 1.1, 1.8 1.1, 3.2 0.9, 5 0.7, 6.1 0.7, 7.3 0.6) LINESTRING (0 2, 1.1 1.7, 3.7 1.2, 5.4 1.6, 6.1 2.1, 7.2 2.2) -MULTILINESTRING ((4 1, 5 1), (2 1, 3 1), (3 1, 4 1)) +LINESTRING (2 1, 3 1, 4 1, 5 1) -MULTILINESTRING ((5 1, 6 1, 7 1), (0 1, 1 1, 2 1), (0 2, 1 2, 2 1), (4 1, 5 1), (2 1, 3 1), (3 1, 4 1), (5 1, 5 2, 6 2, 7 2)) +MULTILINESTRING ((5 1, 6 1, 7 1), (0 1, 1 1, 2 1), (0 2, 1 2, 2 1), (2 1, 3 1, 4 1, 5 1), (5 1, 5 2, 6 2, 7 2)) MULTILINESTRING ((5 1, 6 1, 7 1), (0 1, 1 1, 2 1)) @@ -103,8 +103,8 @@ MULTILINESTRING ((5 1, 6 1, 7 1), (0 1, 1 1, 2 1)) MULTILINESTRING ((0 2, 1 2, 2 1), (5 1, 5 2, 6 2, 7 2)) -MULTILINESTRING ((5 1, 6 1, 7 1), (0 1, 1 1, 2 1), (0 2, 1 2, 2 1), (5 1, 5 2, 6 2, 7 2)) +MULTILINESTRING ((7 2, 6 2, 5 2, 5 1, 6 1, 7 1), (0 1, 1 1, 2 1, 1 2, 0 2)) - \ No newline at end of file + diff --git a/tests/xmltester/tests/general/TestOverlayAA.xml b/tests/xmltester/tests/general/TestOverlayAA.xml index 2f4a5d92e4..6a93130aa6 100644 --- a/tests/xmltester/tests/general/TestOverlayAA.xml +++ b/tests/xmltester/tests/general/TestOverlayAA.xml @@ -357,9 +357,7 @@ GEOMETRYCOLLECTION( POINT(200 240), LINESTRING(300 200, 220 200), - LINESTRING(280 180, 300 180), - LINESTRING(300 180, 300 160), - LINESTRING(300 160, 280 160), + LINESTRING(280 180, 300 180, 300 160, 280 160), LINESTRING(220 140, 240 140), LINESTRING(240 120, 220 120), POLYGON( @@ -451,22 +449,10 @@ POINT(260 160), POINT(280 220), POINT(300 200), - LINESTRING(100 200, 100 180), - LINESTRING(100 180, 120 180), - LINESTRING(120 180, 120 200), - LINESTRING(120 200, 100 200), - LINESTRING(220 140, 220 160), - LINESTRING(220 160, 160 160), - LINESTRING(160 160, 160 180), - LINESTRING(160 180, 200 180), - LINESTRING(200 200, 160 200), - LINESTRING(160 200, 160 220), - LINESTRING(160 220, 220 220), - LINESTRING(220 220, 220 240), - LINESTRING(80 220, 80 160), - LINESTRING(80 160, 140 160), - LINESTRING(140 160, 140 220), - LINESTRING(140 220, 80 220)) + LINESTRING(100 200, 100 180, 120 180, 120 200, 100 200), + LINESTRING(220 140, 220 160, 160 160, 160 180, 200 180), + LINESTRING(200 200, 160 200, 160 220, 220 220, 220 240), + LINESTRING(80 220, 80 160, 140 160, 140 220, 80 220)) diff --git a/tests/xmltester/tests/general/TestOverlayAAPrec.xml b/tests/xmltester/tests/general/TestOverlayAAPrec.xml index f3b8dc0ae6..c87ce14a20 100644 --- a/tests/xmltester/tests/general/TestOverlayAAPrec.xml +++ b/tests/xmltester/tests/general/TestOverlayAAPrec.xml @@ -115,9 +115,7 @@ - MULTILINESTRING( - (10 30, 10 10), - (10 10, 30 10)) + LINESTRING (10 30, 10 10, 30 10) @@ -273,9 +271,7 @@ - MULTILINESTRING( - (10 30, 10 10), - (10 10, 30 10)) + LINESTRING (10 30, 10 10, 30 10) @@ -317,9 +313,7 @@ - MULTILINESTRING( - (10 30, 10 10), - (10 10, 30 10)) + LINESTRING(10 30, 10 10, 30 10) @@ -361,9 +355,7 @@ - MULTILINESTRING( - (10 30, 10 10), - (10 10, 30 10)) + LINESTRING(10 30, 10 10, 30 10) @@ -606,9 +598,7 @@ GEOMETRYCOLLECTION( - MULTILINESTRING( - (160 140, 160 120), - (160 120, 160 100)) + LINESTRING(160 140, 160 120, 160 100) @@ -719,8 +709,7 @@ GEOMETRYCOLLECTION( GEOMETRYCOLLECTION( - LINESTRING(78 39, 83 39), - LINESTRING(83 33, 83 39), + LINESTRING(78 39, 83 39, 83 33), POLYGON( (83 39, 62 402, 68 402, 83 39)), POLYGON( diff --git a/tests/xmltester/tests/general/TestOverlayLA.xml b/tests/xmltester/tests/general/TestOverlayLA.xml index f9444fbf9a..97cab3b827 100644 --- a/tests/xmltester/tests/general/TestOverlayLA.xml +++ b/tests/xmltester/tests/general/TestOverlayLA.xml @@ -20,8 +20,7 @@ GEOMETRYCOLLECTION( LINESTRING(100 240, 100 180, 160 180, 160 120, 220 120), - LINESTRING(40 360, 40 60), - LINESTRING(40 60, 340 60, 40 360), + LINESTRING(40 60, 340 60, 40 360, 40 60), LINESTRING(40 60, 40 20), LINESTRING(120 120, 120 140, 100 140, 100 120, 120 120), LINESTRING(120 120, 140 120), @@ -87,20 +86,16 @@ (220 260, 140 260), (140 260, 120 260), (120 260, 60 260), - (200 240, 140 240), + (220 240, 200 240, 140 240), (140 240, 120 240), - (120 240, 80 240), (180 220, 140 220), (140 220, 120 220), (120 220, 100 220), - (120 200, 120 180), - (220 240, 200 240), - (80 240, 60 240), + (120 220, 120 200, 120 180, 120 160), + (120 240, 80 240, 60 240), (60 220, 80 220), (200 220, 220 220), (120 260, 120 240), - (120 220, 120 200), - (120 180, 120 160), (120 140, 120 120), (140 120, 140 140), (140 160, 140 180), @@ -160,17 +155,14 @@ LINESTRING(80 220, 100 220), LINESTRING(180 220, 200 220), LINESTRING(220 220, 240 220), - LINESTRING(120 300, 120 260), + LINESTRING(120 320, 120 300, 120 260), LINESTRING(120 240, 120 220), LINESTRING(120 160, 120 140), - LINESTRING(120 120, 120 80), - LINESTRING(120 80, 140 80), - LINESTRING(140 80, 140 120), + LINESTRING(120 120, 120 80, 140 80, 140 120), LINESTRING(140 140, 140 160), LINESTRING(140 180, 140 200), LINESTRING(140 220, 140 240), LINESTRING(140 260, 140 300), - LINESTRING(120 300, 120 320), POLYGON( (60 240, 60 260, 120 260, 140 260, 220 260, 220 240, 220 220, 220 120, 140 120, 120 120, 60 120, 60 220, 60 240), @@ -205,8 +197,7 @@ GEOMETRYCOLLECTION( LINESTRING(220 360, 220 320), LINESTRING(220 260, 220 240, 240 240), - LINESTRING(280 240, 300 240), - LINESTRING(300 240, 300 360), + LINESTRING(280 240, 300 240, 300 360), POLYGON( (280 240, 280 120, 60 120, 60 320, 220 320, 280 320, 280 240), (120 260, 120 180, 240 180, 240 240, 240 260, 220 260, 120 260)), @@ -249,10 +240,9 @@ GEOMETRYCOLLECTION( POINT(300 240), POINT(300 360), - LINESTRING(80 300, 80 160), + LINESTRING(220 300, 80 300, 80 160), LINESTRING(80 160, 260 160, 260 240), LINESTRING(260 240, 260 300, 220 300), - LINESTRING(220 300, 80 300), LINESTRING(80 160, 80 140), LINESTRING(220 320, 220 300), LINESTRING(220 300, 220 260), @@ -280,12 +270,9 @@ GEOMETRYCOLLECTION( - LINESTRING(180 260, 120 180), - LINESTRING(120 180, 60 260), - LINESTRING(60 260, 180 260), + LINESTRING(120 180, 60 260, 180 260, 120 180), LINESTRING(60 300, 60 260), - LINESTRING(60 260, 60 80), - LINESTRING(60 80, 60 40), + LINESTRING(60 260, 60 80, 60 40), POLYGON( (60 80, 120 180, 180 80, 60 80)), POLYGON( diff --git a/tests/xmltester/tests/general/TestOverlayLL.xml b/tests/xmltester/tests/general/TestOverlayLL.xml index 89c481eb5c..3d723abb08 100644 --- a/tests/xmltester/tests/general/TestOverlayLL.xml +++ b/tests/xmltester/tests/general/TestOverlayLL.xml @@ -24,9 +24,7 @@ - MULTILINESTRING( - (0 0, 50 50), - (50 50, 100 100)) + LINESTRING(0 0, 50 50, 100 100) @@ -68,9 +66,7 @@ - MULTILINESTRING( - (100 100, 200 200), - (100 100, 200 0)) + LINESTRING(200 0, 100 100, 200 200) @@ -119,10 +115,7 @@ - MULTILINESTRING( - (220 160, 80 300), - (80 320, 220 320), - (220 320, 220 160)) + LINESTRING(80 320, 220 320, 220 160, 80 300) @@ -172,9 +165,7 @@ - MULTILINESTRING( - (60 200, 60 260, 140 200), - (60 200, 60 140, 140 200)) + LINESTRING(60 200, 60 260, 140 200, 60 140, 60 200) @@ -204,19 +195,16 @@ - MULTILINESTRING( - (100 120, 180 200), - (180 200, 100 280, 20 200, 100 120)) + LINESTRING(180 200, 100 280, 20 200, 100 120, 180 200) MULTILINESTRING( (100 120, 180 200), - (100 120, 100 200), + (100 120, 100 200, 180 200), (180 200, 100 280, 20 200, 100 120), - (180 200, 220 200, 220 80, 100 80, 100 120), - (100 200, 180 200)) + (180 200, 220 200, 220 80, 100 80, 100 120)) diff --git a/tests/xmltester/tests/general/TestOverlayLLPrec.xml b/tests/xmltester/tests/general/TestOverlayLLPrec.xml index e47e58661c..17321cebca 100644 --- a/tests/xmltester/tests/general/TestOverlayLLPrec.xml +++ b/tests/xmltester/tests/general/TestOverlayLLPrec.xml @@ -72,29 +72,20 @@ MULTILINESTRING( - (200 220, 177 237), - (177 237, 153 253), - (153 253, 60 320, 40 300, 133 233), - (133 233, 157 217), - (157 217, 180 200), - (160 180, 137 197), - (137 197, 113 213), - (113 213, 20 280)) + (200 220, 177 237, 153 253, 60 320, 40 300, 133 233, 157 217, 180 200), + (160 180, 137 197, 113 213, 20 280)) MULTILINESTRING( - (200 220, 177 237), + (157 217, 180 200, 200 220, 177 237), (177 237, 153 253), (153 253, 60 320, 40 300, 133 233), (133 233, 157 217), - (157 217, 180 200), - (160 180, 137 197), (137 197, 113 213), (113 213, 20 280), - (200 220, 180 200), - (160 180, 140 160, 120 180, 137 197), + (137 197, 160 180, 140 160, 120 180, 137 197), (137 197, 157 217), (157 217, 177 237), (177 237, 220 280, 200 300, 153 253), diff --git a/tests/xmltester/tests/general/TestOverlayPL.xml b/tests/xmltester/tests/general/TestOverlayPL.xml index ba072db469..e47bd6bbf8 100644 --- a/tests/xmltester/tests/general/TestOverlayPL.xml +++ b/tests/xmltester/tests/general/TestOverlayPL.xml @@ -108,8 +108,7 @@ MULTILINESTRING( (100 320, 100 220), (100 180, 200 180), - (220 180, 220 320), - (220 320, 160 320)) + (220 180, 220 320, 160 320)) @@ -120,8 +119,7 @@ POINT(140 320), LINESTRING(100 320, 100 220), LINESTRING(100 180, 200 180), - LINESTRING(220 180, 220 320), - LINESTRING(220 320, 160 320)) + LINESTRING(220 180, 220 320, 160 320)) @@ -157,9 +155,7 @@ MULTILINESTRING( - (-500 -140, -500 -280), - (-500 -280, -320 -280, -320 -140), - (-320 -140, -500 -140), + (-500 -280, -320 -280, -320 -140, -500 -140, -500 -280), (-500 -280, -500 -340)) @@ -170,13 +166,10 @@ POINT(-420 -180), POINT(-320 -120), POINT(-280 -140), - LINESTRING(-500 -140, -500 -280), - LINESTRING(-500 -280, -320 -280, -320 -140), - LINESTRING(-320 -140, -500 -140), + LINESTRING(-500 -280, -320 -280, -320 -140, -500 -140, -500 -280), LINESTRING(-500 -280, -500 -340)) - - + mPmL - points in I, B and E of lines, lines overlap, points overlap @@ -217,8 +210,7 @@ MULTILINESTRING( (100 320, 100 220), (100 180, 200 180), - (220 180, 220 320), - (220 320, 160 320)) + (220 180, 220 320, 160 320)) @@ -229,8 +221,7 @@ POINT(140 320), LINESTRING(100 320, 100 220), LINESTRING(100 180, 200 180), - LINESTRING(220 180, 220 320), - LINESTRING(220 320, 160 320)) + LINESTRING(220 180, 220 320, 160 320)) diff --git a/tests/xmltester/tests/issue/issue-geos-527.xml b/tests/xmltester/tests/issue/issue-geos-527.xml index ba1b2f61e6..ecbf20aebb 100644 --- a/tests/xmltester/tests/issue/issue-geos-527.xml +++ b/tests/xmltester/tests/issue/issue-geos-527.xml @@ -19,7 +19,7 @@ LINESTRING( -MULTILINESTRING ((1725064.13656044 4819094.70235069, 1725063 4819121), (1725063 4819121, 1725064.141830536 4819094.702276371), (1725064.13656044 4819094.70235069, 1725064.141830536 4819094.702276371), (1725064.141830536 4819094.702276371, 1725064.14183882 4819094.70208557, 1725064.13656044 4819094.70235069), (1725064.141830536 4819094.702276371, 1725064.14210362 4819094.70227252)) +MULTILINESTRING ((1725064.13656044 4819094.70235069, 1725063 4819121, 1725064.141830536 4819094.702276371), (1725064.13656044 4819094.70235069, 1725064.141830536 4819094.702276371), (1725064.141830536 4819094.702276371, 1725064.14183882 4819094.70208557, 1725064.13656044 4819094.70235069), (1725064.141830536 4819094.702276371, 1725064.14210362 4819094.70227252)) diff --git a/tests/xmltester/tests/misc/makevalid.xml b/tests/xmltester/tests/misc/makevalid.xml index bee4be4c75..b11a3462c7 100644 --- a/tests/xmltester/tests/misc/makevalid.xml +++ b/tests/xmltester/tests/misc/makevalid.xml @@ -139,7 +139,7 @@ MULTIPOLYGON(((0 0,1 1,0 1,1 0,0 0)),((0.8 0.1,2 0.1,2 0.9,0.8 0.9,0.8 0.1))) - GEOMETRYCOLLECTION(MULTIPOLYGON(((0 0,0.5 0.5,0.8 0.2,0.8 0.8,0.9 0.9,2 0.9,2 0.1,0.9 0.1,1 0,0 0)),((0 1,1 1,0.9 0.9,0.8 0.9,0.8 0.8,0.5 0.5,0 1))),MULTILINESTRING((0.8 0.1,0.9 0.1),(0.8 0.1,0.8 0.2))) + GEOMETRYCOLLECTION(MULTIPOLYGON(((0 0,0.5 0.5,0.8 0.2,0.8 0.8,0.9 0.9,2 0.9,2 0.1,0.9 0.1,1 0,0 0)),((0 1,1 1,0.9 0.9,0.8 0.9,0.8 0.8,0.5 0.5,0 1))),LINESTRING(0.8 0.2, 0.8 0.1,0.9 0.1)) diff --git a/tests/xmltester/tests/misc/split.xml b/tests/xmltester/tests/misc/split.xml index b884e529e5..0a4a794454 100644 --- a/tests/xmltester/tests/misc/split.xml +++ b/tests/xmltester/tests/misc/split.xml @@ -1,49 +1,45 @@ - - Line/line difference/split + Line/line split LINESTRING(2 0,10 0,10 10,0 10,0 2) LINESTRING(-5 5, 15 5) - - MULTILINESTRING((2 0,10 0,10 5),(10 5,10 10,0 10,0 5),(0 5,0 2)) + + GEOMETRYCOLLECTION(LINESTRING(2 0,10 0,10 5),LINESTRING(10 5,10 10,0 10,0 5),LINESTRING(0 5,0 2)) - Line/line difference/split with boundary intersection + Line/line split with boundary intersection LINESTRING(2 0,10 0,10 10,0 10,0 2) LINESTRING(0 5, 10 5) - - MULTILINESTRING((2 0,10 0,10 5),(10 5,10 10,0 10,0 5),(0 5,0 2)) + + GEOMETRYCOLLECTION(LINESTRING(2 0,10 0,10 5),LINESTRING(10 5,10 10,0 10,0 5),LINESTRING(0 5,0 2)) - Multiline/line difference/split + Multiline/line split MULTILINESTRING((0 0, 0 10), (5 0, 5 10), (10 0, 10 10)) LINESTRING(-5 5, 15 5) - - MULTILINESTRING((0 0,0 5),(0 5,0 10),(5 0,5 5),(5 5,5 10),(10 0,10 5),(10 5,10 10)) + + GEOMETRYCOLLECTION(LINESTRING(0 0,0 5),LINESTRING(0 5,0 10),LINESTRING(5 0,5 5),LINESTRING(5 5,5 10),LINESTRING(10 0,10 5),LINESTRING(10 5,10 10)) - Multiline/line difference/split with boundary intersection + Multiline/line split with boundary intersection MULTILINESTRING((0 0, 0 10), (5 0, 5 10), (10 0, 10 10)) LINESTRING(0 5, 10 5) - - MULTILINESTRING((0 0,0 5),(0 5,0 10),(5 0,5 5),(5 5,5 10),(10 0,10 5),(10 5,10 10)) + + GEOMETRYCOLLECTION(LINESTRING(0 0,0 5),LINESTRING(0 5,0 10),LINESTRING(5 0,5 5),LINESTRING(5 5,5 10),LINESTRING(10 0,10 5),LINESTRING(10 5,10 10))