|
| 1 | +using Plots |
| 2 | + |
1 | 3 | @testset "Geo interface" begin |
2 | 4 | pt = LibGEOS.Point(1.0, 2.0) |
3 | 5 | @test GeoInterface.coordinates(pt) ≈ [1, 2] atol = 1e-5 |
|
6 | 8 | @test GeoInterface.getcoord(pt, 1) ≈ 1.0 |
7 | 9 | @test GeoInterface.testgeometry(pt) |
8 | 10 | @test GeoInterface.extent(pt) == Extent(X = (1.0, 1.0), Y = (2.0, 2.0)) |
| 11 | + plot(pt) |
9 | 12 |
|
10 | 13 | pt = LibGEOS.Point(1, 2) |
11 | 14 | @test GeoInterface.coordinates(pt) ≈ [1, 2] atol = 1e-5 |
|
27 | 30 | @test p isa LibGEOS.Point |
28 | 31 | @test GeoInterface.coordinates(p) == [10, 0] |
29 | 32 | @test GeoInterface.testgeometry(mpt) |
| 33 | + plot(mpt) |
30 | 34 |
|
31 | 35 | coords = Vector{Float64}[[8, 1], [9, 1], [9, 2], [8, 2]] |
32 | 36 | ls = LibGEOS.LineString(coords) |
|
37 | 41 | @test p isa LibGEOS.Point |
38 | 42 | @test GeoInterface.coordinates(p) == [9, 2] |
39 | 43 | @test GeoInterface.testgeometry(ls) |
| 44 | + plot(ls) |
40 | 45 |
|
41 | 46 | ls = LibGEOS.readgeom("LINESTRING EMPTY") |
42 | 47 | @test GeoInterface.coordinates(ls) == [] |
|
48 | 53 | @test GeoInterface.geomtrait(mls) == MultiLineStringTrait() |
49 | 54 | @test GeoInterface.ngeom(mls) == 2 |
50 | 55 | @test GeoInterface.testgeometry(mls) |
| 56 | + plot(mls) |
51 | 57 |
|
52 | 58 | coords = Vector{Float64}[[8, 1], [9, 1], [9, 2], [8, 2], [8, 1]] |
53 | 59 | lr = LibGEOS.LinearRing(coords) |
|
58 | 64 | @test p isa LibGEOS.Point |
59 | 65 | @test GeoInterface.coordinates(p) == [9, 2] |
60 | 66 | @test GeoInterface.testgeometry(lr) |
| 67 | + # Cannot convert LinearRingTrait to series data for plotting |
| 68 | + # plot(lr) |
61 | 69 |
|
62 | 70 | coords = Vector{Vector{Float64}}[ |
63 | 71 | Vector{Float64}[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]], |
|
72 | 80 | @test ls isa LibGEOS.LinearRing |
73 | 81 | @test GeoInterface.coordinates(ls) == coords[2] |
74 | 82 | @test GeoInterface.testgeometry(polygon) |
| 83 | + plot(polygon) |
75 | 84 |
|
76 | 85 | polygon = LibGEOS.readgeom("POLYGON EMPTY") |
77 | 86 | @test GeoInterface.coordinates(polygon) == [[]] |
|
90 | 99 | @test GeoInterface.geomtrait(multipolygon) == MultiPolygonTrait() |
91 | 100 | @test GeoInterface.testgeometry(multipolygon) |
92 | 101 | @test GeoInterface.extent(multipolygon) == Extent(X = (0.0, 10.0), Y = (0.0, 10.0)) |
| 102 | + plot(multipolygon) |
93 | 103 |
|
94 | 104 | pmultipolygon = LibGEOS.prepareGeom(multipolygon) |
95 | 105 | @test GeoInterface.geomtrait(pmultipolygon) == MultiPolygonTrait() |
|
167 | 177 | end |
168 | 178 | @test GeoInterface.geomtrait(geomcollection) == GeometryCollectionTrait() |
169 | 179 | @test GeoInterface.testgeometry(geomcollection) |
| 180 | + plot(geomcollection) |
170 | 181 |
|
171 | 182 | geomcollection = LibGEOS.readgeom( |
172 | 183 | "GEOMETRYCOLLECTION(MULTIPOINT(0 0, 0 0, 1 1),LINESTRING(1 1, 2 2, 2 2, 0 0),POLYGON((5 5, 0 0, 0 2, 2 2, 5 5)))", |
|
0 commit comments