Skip to content

Commit

Permalink
Use LibGEOS.equals instead "==" to compare geometries (#81)
Browse files Browse the repository at this point in the history
Use LibGEOS.equals instead "==" to compare geometries
  • Loading branch information
jaakkor2 authored Dec 27, 2020
1 parent 2152760 commit e5a0818
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 41 deletions.
88 changes: 48 additions & 40 deletions test/test_geos_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
expected_ = LibGEOS._readgeom("LINESTRING (130 240, 650 240)")
output_ = LibGEOS.convexhull(input_)
@test !LibGEOS.isEmpty(output_)
@test LibGEOS._writegeom(output_) == LibGEOS._writegeom(expected_)
@test LibGEOS.equals(output_, expected_)
LibGEOS.destroyGeom(input_)
LibGEOS.destroyGeom(expected_)
LibGEOS.destroyGeom(output_)
Expand Down Expand Up @@ -161,15 +161,15 @@
LibGEOS.destroyGeom(geom2_)
geom2_ = LibGEOS.delaunayTriangulation(geom1_, 0.0, true)
geom3_ = LibGEOS._readgeom("MULTILINESTRING ((5 0, 10 0), (0 0, 5 0))")
@test LibGEOS._writegeom(geom2_) == LibGEOS._writegeom(geom3_)
@test LibGEOS.equals(geom2_, geom3_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)

geom1_ = LibGEOS._readgeom("MULTIPOINT(0 0, 10 0, 10 10, 11 10)")
geom2_ = LibGEOS.delaunayTriangulation(geom1_, 2.0, true)
geom3_ = LibGEOS._readgeom("MULTILINESTRING ((0 0, 10 10), (0 0, 10 0), (10 0, 10 10))")
@test LibGEOS._writegeom(geom2_) == LibGEOS._writegeom(geom3_)
@test LibGEOS.equals(geom2_, geom3_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)
Expand Down Expand Up @@ -208,31 +208,31 @@
geom1_ = LibGEOS._readgeom("POINT(10 0)")
geom2_ = LibGEOS.centroid(geom1_)
geom3_ = LibGEOS._readgeom("POINT (10 0)")
@test LibGEOS._writegeom(geom2_) == LibGEOS._writegeom(geom3_)
@test LibGEOS.equals(geom2_, geom3_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)

geom1_ = LibGEOS._readgeom("LINESTRING(0 0, 10 0)")
geom2_ = LibGEOS.centroid(geom1_)
geom3_ = LibGEOS._readgeom("POINT (5 0)")
@test LibGEOS._writegeom(geom2_) == LibGEOS._writegeom(geom3_)
@test LibGEOS.equals(geom2_, geom3_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)

geom1_ = LibGEOS._readgeom("POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))")
geom2_ = LibGEOS.centroid(geom1_)
geom3_ = LibGEOS._readgeom("POINT (5 5)")
@test LibGEOS._writegeom(geom2_) == LibGEOS._writegeom(geom3_)
@test LibGEOS.equals(geom2_, geom3_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)

geom1_ = LibGEOS._readgeom("LINESTRING EMPTY")
geom2_ = LibGEOS.centroid(geom1_)
geom3_ = LibGEOS._readgeom("POINT EMPTY")
@test LibGEOS._writegeom(geom2_) == LibGEOS._writegeom(geom3_)
@test LibGEOS.equals(geom2_, geom3_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)
Expand All @@ -241,15 +241,17 @@
geom1_ = LibGEOS._readgeom("POLYGON EMPTY")
geom2_ = LibGEOS._readgeom("POLYGON EMPTY")
geom3_ = LibGEOS.intersection(geom1_, geom2_)
@test LibGEOS._writegeom(geom3_) == "GEOMETRYCOLLECTION EMPTY"
geom4_ = LibGEOS._readgeom("GEOMETRYCOLLECTION EMPTY")
@test LibGEOS.equals(geom3_, geom4_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)
LibGEOS.destroyGeom(geom4_)

geom1_ = LibGEOS._readgeom("POLYGON((1 1,1 5,5 5,5 1,1 1))")
geom2_ = LibGEOS._readgeom("POINT(2 2)")
geom3_ = LibGEOS.intersection(geom1_, geom2_)
@test LibGEOS._writegeom(geom3_) == LibGEOS._writegeom(geom2_)
@test LibGEOS.equals(geom3_, geom2_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)
Expand All @@ -258,7 +260,7 @@
geom2_ = LibGEOS._readgeom("POLYGON((-1 1,-1 2,2 2,2 1,-1 1))")
geom3_ = LibGEOS.intersection(geom1_, geom2_)
geom4_ = LibGEOS._readgeom("POLYGON ((0 1, 0 2, 2 2, 2 1, 0 1))")
@test LibGEOS._writegeom(geom3_) == LibGEOS._writegeom(geom4_)
@test LibGEOS.equals(geom3_, geom4_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)
Expand All @@ -268,7 +270,7 @@
geom2_ = LibGEOS._readgeom("POLYGON((0 1,0 2,10 2,10 1,0 1))")
geom3_ = LibGEOS.intersection(geom1_, geom2_)
geom4_ = LibGEOS._readgeom("GEOMETRYCOLLECTION (LINESTRING (1 2, 2 2), LINESTRING (2 1, 1 1), POLYGON ((0.5 1, 1 2, 1 1, 0.5 1)), POLYGON ((9 2, 9.5 1, 2 1, 2 2, 9 2)))")
@test LibGEOS._writegeom(geom3_) == LibGEOS._writegeom(geom4_)
@test LibGEOS.equals(geom3_, geom4_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)
Expand Down Expand Up @@ -342,7 +344,7 @@
geom2_ = LibGEOS.node(geom1_)
LibGEOS.normalize!(geom2_)
geom3_ = LibGEOS._readgeom("MULTILINESTRING ((5 5, 10 0, 10 10, 5 5), (0 10, 5 5), (0 0, 5 5))")
@test LibGEOS._writegeom(geom2_) == LibGEOS._writegeom(geom3_)
@test equals(geom2_, geom3_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)
Expand All @@ -351,7 +353,7 @@
geom2_ = LibGEOS.node(geom1_)
LibGEOS.normalize!(geom2_)
geom3_ = LibGEOS._readgeom("MULTILINESTRING ((4 0, 5 0), (3 0, 4 0), (2 0, 3 0), (1 0, 2 0), (0 0, 1 0))")
@test LibGEOS._writegeom(geom2_) == LibGEOS._writegeom(geom3_)
@test LibGEOS.equals(geom2_, geom3_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)
Expand All @@ -360,7 +362,7 @@
geom2_ = LibGEOS.node(geom1_)
LibGEOS.normalize!(geom2_)
geom3_ = LibGEOS._readgeom("MULTILINESTRING ((2 0, 4 0), (0 0, 2 0))")
@test LibGEOS._writegeom(geom2_) == LibGEOS._writegeom(geom3_)
@test LibGEOS.equals(geom2_, geom3_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)
Expand All @@ -369,23 +371,23 @@
geom1_ = LibGEOS._readgeom("POINT(10 0)")
geom2_ = LibGEOS.pointOnSurface(geom1_)
geom3_ = LibGEOS._readgeom("POINT (10 0)")
@test LibGEOS._writegeom(geom2_) == LibGEOS._writegeom(geom3_)
@test LibGEOS.equals(geom2_, geom3_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)

geom1_ = LibGEOS._readgeom("LINESTRING(0 0, 5 0, 10 0)")
geom2_ = LibGEOS.pointOnSurface(geom1_)
geom3_ = LibGEOS._readgeom("POINT (5 0)")
@test LibGEOS._writegeom(geom2_) == LibGEOS._writegeom(geom3_)
@test LibGEOS.equals(geom2_, geom3_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)

geom1_ = LibGEOS._readgeom("POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))")
geom2_ = LibGEOS.pointOnSurface(geom1_)
geom3_ = LibGEOS._readgeom("POINT (5 5)")
@test LibGEOS._writegeom(geom2_) == LibGEOS._writegeom(geom3_)
@test LibGEOS.equals(geom2_, geom3_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)
Expand All @@ -403,12 +405,16 @@

geom1_ = LibGEOS._readgeom("LINESTRING EMPTY")
geom2_ = LibGEOS.pointOnSurface(geom1_)
@test LibGEOS._writegeom(geom2_) == "POINT EMPTY"
geom3_ = LibGEOS._readgeom("POINT EMPTY")
@test LibGEOS.equals(geom2_, geom3_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)

geom1_ = LibGEOS._readgeom("LINESTRING(0 0, 0 0)")
geom2_ = LibGEOS.pointOnSurface(geom1_)
geom3_ = LibGEOS._readgeom("POINT (0 0)")
@test LibGEOS._writegeom(geom2_) == LibGEOS._writegeom(geom3_)
@test LibGEOS.equals(geom2_, geom3_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)
Expand Down Expand Up @@ -465,7 +471,7 @@
geom2_ = LibGEOS._readgeom("LINESTRING (-29 -20, 50 60, 50 70, 51 0)")
geom3_ = LibGEOS.sharedPaths(geom1_, geom2_)
geom4_ = LibGEOS._readgeom("GEOMETRYCOLLECTION (MULTILINESTRING ((50 60, 50 70)), MULTILINESTRING EMPTY)")
@test LibGEOS._writegeom(geom3_) == LibGEOS._writegeom(geom4_)
@test LibGEOS.equals(geom3_, geom4_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)
Expand Down Expand Up @@ -501,7 +507,7 @@
geom2_ = LibGEOS._readgeom("POINT(0.5 0)")
geom3_ = LibGEOS.snap(geom1_, geom2_, 1.0)
geom4_ = LibGEOS._readgeom("POLYGON ((0.5 0, 10 0, 10 10, 0 10, 0.5 0))")
@test LibGEOS._writegeom(geom3_) == LibGEOS._writegeom(geom4_)
@test LibGEOS.equals(geom3_, geom4_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)
Expand All @@ -511,7 +517,7 @@
geom2_ = LibGEOS._readgeom("LINESTRING (-29 -20, 40 60, 51 0)")
geom3_ = LibGEOS.snap(geom1_, geom2_, 2.0)
geom4_ = LibGEOS._readgeom("LINESTRING (-29 -20, 50 60, 51 0)")
@test LibGEOS._writegeom(geom3_) == LibGEOS._writegeom(geom4_)
@test LibGEOS.equals(geom3_, geom4_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)
Expand All @@ -521,7 +527,7 @@
geom2_ = LibGEOS._readgeom("LINESTRING (-10 -9, 40 20, 80 79)")
geom3_ = LibGEOS.snap(geom1_, geom2_, 2.0)
geom4_ = LibGEOS._readgeom("LINESTRING (-20 -20, -10 -9, 50 50, 80 79, 100 100)")
@test LibGEOS._writegeom(geom3_) == LibGEOS._writegeom(geom4_)
@test LibGEOS.equals(geom3_, geom4_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)
Expand All @@ -530,15 +536,15 @@
geom1_ = LibGEOS._readgeom("LINESTRING(0 0, 10 0)")
geom2_ = LibGEOS._readgeom("LINESTRING(0 0, 9 0)")
geom3_ = LibGEOS.snap(geom1_, geom2_, 2.0)
@test LibGEOS._writegeom(geom3_) == LibGEOS._writegeom(geom2_)
@test LibGEOS.equals(geom3_, geom2_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)

geom1_ = LibGEOS._readgeom("LINESTRING(0 0, 10 0)")
geom2_ = LibGEOS._readgeom("LINESTRING(0 0, 9 0, 10 0, 11 0)")
geom3_ = LibGEOS.snap(geom1_, geom2_, 2.0)
@test LibGEOS._writegeom(geom3_) == LibGEOS._writegeom(geom2_)
@test LibGEOS.equals(geom3_, geom2_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)
Expand All @@ -547,7 +553,7 @@
geom2_ = LibGEOS._readgeom("MULTIPOINT(5 0,4 1)")
geom3_ = LibGEOS.snap(geom1_, geom2_, 2.0)
geom4_ = LibGEOS._readgeom("LINESTRING (0 3, 4 1, 5 0, 0 1)")
@test LibGEOS._writegeom(geom3_) == LibGEOS._writegeom(geom4_)
@test LibGEOS.equals(geom3_, geom4_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)
Expand All @@ -557,7 +563,7 @@
geom2_ = LibGEOS._readgeom("MULTIPOINT(4 1,5 0)")
geom3_ = LibGEOS.snap(geom1_, geom2_, 2.0)
geom4_ = LibGEOS._readgeom("LINESTRING (0 3, 4 1, 5 0, 0 1)")
@test LibGEOS._writegeom(geom3_) == LibGEOS._writegeom(geom4_)
@test LibGEOS.equals(geom3_, geom4_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)
Expand All @@ -567,7 +573,7 @@
geom2_ = LibGEOS._readgeom("MULTIPOINT(0 0,-1 0)")
geom3_ = LibGEOS.snap(geom1_, geom2_, 3.0)
geom4_ = LibGEOS._readgeom("LINESTRING (-1 0, 0 0, 10 0, 10 10, 0 10, -1 0)")
@test LibGEOS._writegeom(geom3_) == LibGEOS._writegeom(geom4_)
@test LibGEOS.equals(geom3_, geom4_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)
Expand All @@ -577,7 +583,7 @@
geom2_ = LibGEOS._readgeom("POINT(5 0)")
geom3_ = LibGEOS.snap(geom1_, geom2_, 3.0)
geom4_ = LibGEOS._readgeom("LINESTRING (0 2, 5 2, 9 2, 5 0)")
@test LibGEOS._writegeom(geom3_) == LibGEOS._writegeom(geom4_)
@test LibGEOS.equals(geom3_, geom4_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)
Expand All @@ -587,7 +593,7 @@
geom2_ = LibGEOS._readgeom("MULTIPOINT(-71.1261 42.2703,-71.1257 42.2703,-71.1261 42.2702)")
geom3_ = LibGEOS.snap(geom1_, geom2_, 0.5)
geom4_ = LibGEOS._readgeom("LINESTRING (-71.1257 42.2703, -71.1261 42.2703, -71.1261 42.2702, -71.1317 42.2509)")
@test LibGEOS._writegeom(geom3_) == LibGEOS._writegeom(geom4_)
@test LibGEOS.equals(geom3_, geom4_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)
Expand All @@ -596,62 +602,64 @@
# GEOSUnaryUnionTest
geom1_ = LibGEOS._readgeom("POINT EMPTY")
geom2_ = LibGEOS.unaryUnion(geom1_)
@test LibGEOS._writegeom(geom2_) == "POINT EMPTY"
geom3_ = LibGEOS._readgeom("POINT EMPTY")
@test LibGEOS.equals(geom2_, geom3_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)

geom1_ = LibGEOS._readgeom("POINT (6 3)")
geom2_ = LibGEOS.unaryUnion(geom1_)
geom3_ = LibGEOS._readgeom("POINT (6 3)")
@test LibGEOS._writegeom(geom2_) == LibGEOS._writegeom(geom3_)
@test LibGEOS.equals(geom2_, geom3_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)

geom1_ = LibGEOS._readgeom("POINT (4 5 6)")
geom2_ = LibGEOS.unaryUnion(geom1_)
geom3_ = LibGEOS._readgeom("POINT Z (4 5 6)")
@test LibGEOS._writegeom(geom2_) == LibGEOS._writegeom(geom3_)
@test LibGEOS.equals(geom2_, geom3_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)

geom1_ = LibGEOS._readgeom("MULTIPOINT (4 5, 6 7, 4 5, 6 5, 6 7)")
geom2_ = LibGEOS.unaryUnion(geom1_)
geom3_ = LibGEOS._readgeom("MULTIPOINT (4 5, 6 5, 6 7)")
@test LibGEOS._writegeom(geom2_) == LibGEOS._writegeom(geom3_)
@test LibGEOS.equals(geom2_, geom3_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)

geom1_ = LibGEOS._readgeom("GEOMETRYCOLLECTION (POINT(4 5), MULTIPOINT(6 7, 6 5, 6 7), LINESTRING(0 5, 10 5), LINESTRING(4 -10, 4 10))")
geom2_ = LibGEOS.unaryUnion(geom1_)
geom3_ = LibGEOS._readgeom("GEOMETRYCOLLECTION (POINT (6 7), LINESTRING (0 5, 4 5), LINESTRING (4 5, 10 5), LINESTRING (4 -10, 4 5), LINESTRING (4 5, 4 10))")
@test LibGEOS._writegeom(geom2_) == LibGEOS._writegeom(geom3_)
@test LibGEOS.equals(geom2_, geom3_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)

geom1_ = LibGEOS._readgeom("GEOMETRYCOLLECTION (POINT(4 5), MULTIPOINT(6 7, 6 5, 6 7), POLYGON((0 0, 10 0, 10 10, 0 10, 0 0),(5 6, 7 6, 7 8, 5 8, 5 6)))")
geom2_ = LibGEOS.unaryUnion(geom1_)
geom3_ = LibGEOS._readgeom("GEOMETRYCOLLECTION (POINT (6 7), POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0), (5 6, 7 6, 7 8, 5 8, 5 6)))")
@test LibGEOS._writegeom(geom2_) == LibGEOS._writegeom(geom3_)
@test LibGEOS.equals(geom2_, geom3_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)

geom1_ = LibGEOS._readgeom("GEOMETRYCOLLECTION (MULTILINESTRING((5 7, 12 7), (4 5, 6 5), (5.5 7.5, 6.5 7.5)), POLYGON((0 0, 10 0, 10 10, 0 10, 0 0),(5 6, 7 6, 7 8, 5 8, 5 6)))")
geom2_ = LibGEOS.unaryUnion(geom1_)
geom3_ = LibGEOS._readgeom("GEOMETRYCOLLECTION (LINESTRING (5 7, 7 7), LINESTRING (10 7, 12 7), LINESTRING (5.5 7.5, 6.5 7.5), POLYGON ((10 7, 10 0, 0 0, 0 10, 10 10, 10 7), (5 6, 7 6, 7 7, 7 8, 5 8, 5 7, 5 6)))")
@test LibGEOS._writegeom(geom2_) == LibGEOS._writegeom(geom3_)
@test LibGEOS.equals(geom2_, geom3_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)

geom1_ = LibGEOS._readgeom("GEOMETRYCOLLECTION (MULTILINESTRING((5 7, 12 7), (4 5, 6 5), (5.5 7.5, 6.5 7.5)), POLYGON((0 0, 10 0, 10 10, 0 10, 0 0),(5 6, 7 6, 7 8, 5 8, 5 6)), MULTIPOINT(6 6.5, 6 1, 12 2, 6 1))")
geom2_ = LibGEOS.unaryUnion(geom1_)
geom3_ = LibGEOS._readgeom("GEOMETRYCOLLECTION (POINT (6 6.5), POINT (12 2), LINESTRING (5 7, 7 7), LINESTRING (10 7, 12 7), LINESTRING (5.5 7.5, 6.5 7.5), POLYGON ((10 7, 10 0, 0 0, 0 10, 10 10, 10 7), (5 6, 7 6, 7 7, 7 8, 5 8, 5 7, 5 6)))")
@test LibGEOS._writegeom(geom2_) == LibGEOS._writegeom(geom3_)
@test LibGEOS.equals(geom2_, geom3_)
LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)
Expand Down Expand Up @@ -725,7 +733,7 @@
geom3_ = setPrecision(geom1_, 5.0, flags = LibGEOS.GEOS_PREC_KEEP_COLLAPSED)
# @test equals(geom3_, readgeom("LINESTRING (0 0, 0 0)")) # false ??
@test writegeom(geom3_) == "LINESTRING (0 0, 0 0)"

LibGEOS.destroyGeom(geom1_)
LibGEOS.destroyGeom(geom2_)
LibGEOS.destroyGeom(geom3_)
Expand All @@ -735,7 +743,7 @@
input_ = readgeom("POLYGON ((1 6, 6 11, 11 6, 6 1, 1 6))")
output_ = minimumRotatedRectangle(input_)
expected_ = readgeom("POLYGON ((6 1, 11 6, 6 11, 1 6, 6 1))")
@test writegeom(output_) == writegeom(expected_)
@test LibGEOS.equals(output_, expected_)
LibGEOS.destroyGeom(input_)
LibGEOS.destroyGeom(output_)
LibGEOS.destroyGeom(expected_)
Expand Down
2 changes: 1 addition & 1 deletion test/test_geos_operations.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function equivalent_to_wkt(geom::GeoInterface.AbstractGeometry, wkt::String)
test_geom = readgeom(wkt)
@test writegeom(geom) == writegeom(test_geom)
@test LibGEOS.equals(geom, test_geom)
end

function factcheck(f::Function, geom::String, expected::String)
Expand Down

0 comments on commit e5a0818

Please sign in to comment.