|
| 1 | +@testset "WKTWriter" begin |
| 2 | + # default writing options |
| 3 | + p = readgeom("POINT(0.12345 2.000 0.1)") |
| 4 | + @test writegeom(p) == "POINT Z (0.12345 2 0.1)" |
| 5 | + |
| 6 | + p = readgeom("POINT(0.12345 2.000)") |
| 7 | + @test writegeom(p) == "POINT (0.12345 2)" |
| 8 | + |
| 9 | + # round to 2 decimals |
| 10 | + writer = LibGEOS.WKTWriter(LibGEOS._context, trim=true, outputdim=3, roundingprecision=2) |
| 11 | + @test writegeom(p, writer) == "POINT (0.12 2)" |
| 12 | + |
| 13 | + # round to 2 decimals and don't trim trailing zeros |
| 14 | + writer = LibGEOS.WKTWriter(LibGEOS._context, trim=false, outputdim=3, roundingprecision=2) |
| 15 | + @test writegeom(p, writer) == "POINT (0.12 2.00)" |
| 16 | + |
| 17 | + # don't output the Z dimension |
| 18 | + p = readgeom("POINT(0.12345 2.000 0.1)") |
| 19 | + writer = LibGEOS.WKTWriter(LibGEOS._context, trim=false, outputdim=2, roundingprecision=2) |
| 20 | + @test writegeom(p, writer) == "POINT (0.12 2.00)" |
| 21 | +end |
| 22 | + |
1 | 23 | @testset "GEOS functions" begin |
2 | 24 | a = LibGEOS.createCoordSeq(Vector{Float64}[[1,2,3],[4,5,6]]) |
3 | 25 | b = LibGEOS.cloneCoordSeq(a) |
|
693 | 715 | geom_ = LibGEOS._readgeom("LINESTRING(0 0, 0 1, 1 1, 0 0)") |
694 | 716 | @test LibGEOS.isClosed(geom_) |
695 | 717 | LibGEOS.destroyGeom(geom_) |
696 | | - |
| 718 | + |
697 | 719 | # setPrecision, getPrecision |
698 | 720 | # Taken from https://git.osgeo.org/gitea/geos/geos/src/branch/master/tests/unit/capi/GEOSGeom_setPrecisionTest.cpp |
699 | 721 |
|
|
733 | 755 | geom3_ = setPrecision(geom1_, 5.0, flags = LibGEOS.GEOS_PREC_KEEP_COLLAPSED) |
734 | 756 | # @test equals(geom3_, readgeom("LINESTRING (0 0, 0 0)")) # false ?? |
735 | 757 | @test writegeom(geom3_) == "LINESTRING (0 0, 0 0)" |
736 | | - |
| 758 | + |
737 | 759 | LibGEOS.destroyGeom(geom1_) |
738 | 760 | LibGEOS.destroyGeom(geom2_) |
739 | 761 | LibGEOS.destroyGeom(geom3_) |
|
0 commit comments