|
1 | 1 | @testset "Basic types" begin
|
2 | 2 | point = Point(2, 3)
|
| 3 | + @test geomtrait(point) isa PointTrait |
3 | 4 | @test testgeometry(point)
|
4 | 5 | @test ncoord(point) == 2
|
5 | 6 | @test getcoord(point, 2) == 3
|
6 | 7 | @test GeoInterface.coordinates(point) == [2, 3]
|
7 | 8 |
|
| 9 | + line = Line(Point(2, 3), Point(4, 5)) |
| 10 | + @test geomtrait(line) isa LineTrait |
| 11 | + @test testgeometry(line) |
| 12 | + @test ngeom(line) == 2 |
| 13 | + @test getgeom(line, 2) == Point(4, 5) |
| 14 | + @test GeoInterface.coordinates(line) == [[2, 3], [4, 5]] |
| 15 | + |
8 | 16 | mp = MultiPoint([point, point])
|
| 17 | + @test geomtrait(mp) isa MultiPointTrait |
9 | 18 | @test testgeometry(mp)
|
10 | 19 | @test ngeom(mp) == 2
|
11 | 20 | @test getgeom(mp, 2) == point
|
12 | 21 | @test GeoInterface.coordinates(mp) == [[2, 3], [2, 3]]
|
13 | 22 |
|
14 | 23 | linestring = LineString(Point{2,Int}[(10, 10), (20, 20), (10, 40)])
|
| 24 | + @test geomtrait(linestring) isa LineStringTrait |
15 | 25 | @test testgeometry(linestring)
|
16 | 26 | @test ngeom(linestring) == 3
|
17 | 27 | @test ncoord(linestring) == 2
|
|
21 | 31 | @test GeoInterface.coordinates(linestring) == [[10, 10], [20, 20], [10, 40]]
|
22 | 32 |
|
23 | 33 | multilinestring = MultiLineString([linestring, linestring])
|
| 34 | + @test geomtrait(multilinestring) isa MultiLineStringTrait |
24 | 35 | @test testgeometry(multilinestring)
|
25 | 36 | @test GeoInterface.coordinates(multilinestring) ==
|
26 | 37 | [[[10, 10], [20, 20], [10, 40]], [[10, 10], [20, 20], [10, 40]]]
|
27 | 38 | @test ncoord(multilinestring) == 2
|
28 | 39 |
|
29 | 40 | poly = Polygon(rand(Point{2,Float32}, 5), [rand(Point{2,Float32}, 5)])
|
| 41 | + @test geomtrait(poly) isa PolygonTrait |
30 | 42 | @test testgeometry(poly)
|
31 | 43 | @test length(GeoInterface.coordinates(poly)) == 2
|
32 | 44 | @test length(GeoInterface.coordinates(poly)[1]) == 5
|
33 | 45 |
|
34 | 46 | triangle = Triangle(point, point, point)
|
| 47 | + @test geomtrait(triangle) isa PolygonTrait # ?? should it be a Triangle trait |
35 | 48 | @test testgeometry(triangle)
|
36 | 49 | @test length(GeoInterface.coordinates(triangle)) == 1
|
37 | 50 | @test length(GeoInterface.coordinates(triangle)[1]) == 3
|
38 | 51 |
|
39 | 52 | polys = MultiPolygon([poly, poly])
|
| 53 | + @test geomtrait(polys) isa MultiPolygonTrait |
40 | 54 | @test testgeometry(polys)
|
41 | 55 | @test length(GeoInterface.coordinates(polys)) == 2
|
42 | 56 | @test length(GeoInterface.coordinates(polys)[1]) == 2
|
|
0 commit comments