@@ -56,7 +56,7 @@ using GeometryBasics: attributes
56
56
end
57
57
58
58
end
59
-
59
+
60
60
@testset " polygon with metadata" begin
61
61
polys = [Polygon (rand (Point{2 , Float32}, 20 )) for i in 1 : 10 ]
62
62
pnames = [randstring (4 ) for i in 1 : 10 ]
@@ -68,7 +68,7 @@ using GeometryBasics: attributes
68
68
multipoly = MultiPolygonMeta (polys, name = pnames, value = numbers, category = bin)
69
69
@test multipoly isa AbstractVector
70
70
@test poly isa GeometryBasics. AbstractPolygon
71
-
71
+
72
72
@test GeometryBasics. getcolumn (poly, :name ) == pnames[1 ]
73
73
@test GeometryBasics. MetaFree (PolygonMeta) == Polygon
74
74
@@ -92,7 +92,7 @@ using GeometryBasics: attributes
92
92
@test metafree (pm) === p
93
93
@test propertynames (pm) == (:position , :a , :b )
94
94
end
95
-
95
+
96
96
@testset " MultiPoint with metadata" begin
97
97
p = collect (Point {2, Float64} (x, x+ 1 ) for x in 1 : 5 )
98
98
@test p isa AbstractVector
@@ -144,18 +144,18 @@ end
144
144
multipoly = MetaT (multipol, name = pnames, value = numbers, category = bin)
145
145
@test multipoly isa MetaT
146
146
@test poly isa MetaT
147
-
147
+
148
148
@test GeometryBasics. getcolumn (poly, :name ) == pnames[1 ]
149
149
@test GeometryBasics. getcolumn (multipoly, :name ) == pnames
150
-
150
+
151
151
meta_p = MetaT (polys[1 ], boundingbox= Rect (0 , 0 , 2 , 2 ))
152
152
@test meta_p. boundingbox === Rect (0 , 0 , 2 , 2 )
153
153
@test GeometryBasics. metafree (meta_p) == polys[1 ]
154
154
@test GeometryBasics. metafree (poly) == polys[1 ]
155
155
@test GeometryBasics. metafree (multipoly) == multipol
156
156
@test GeometryBasics. meta (meta_p) == (boundingbox = GeometryBasics. HyperRectangle {2,Int64} ([0 , 0 ], [2 , 2 ]),)
157
157
@test GeometryBasics. meta (poly) == (name = pnames[1 ], value = 0.0 , category = bin[1 ])
158
- @test GeometryBasics. meta (multipoly) == (name = pnames, value = numbers, category = bin)
158
+ @test GeometryBasics. meta (multipoly) == (name = pnames, value = numbers, category = bin)
159
159
end
160
160
161
161
@testset " MetaT{Point}" begin
171
171
@test GeometryBasics. metafree (pm) == p
172
172
@test GeometryBasics. meta (pm) == (a = 1 , b = 2 )
173
173
end
174
-
174
+
175
175
@testset " MetaT{MultiPoint}" begin
176
176
p = collect (Point {2, Float64} (x, x+ 1 ) for x in 1 : 5 )
177
177
@test p isa AbstractVector
623
623
624
624
@testset " MetaT and heterogeneous data" begin
625
625
ls = [LineString ([Point (i, (i+ 1 )^ 2 / 6 ), Point (i* 0.86 ,i+ 5 ), Point (i/ 3 , i/ 7 )]) for i in 1 : 10 ]
626
- mls = MultiLineString ([LineString ([Point (i+ 1 , (i)^ 2 / 6 ), Point (i* 0.75 ,i+ 8 ), Point (i/ 2.5 , i/ 6.79 )]) for i in 5 : 10 ])
626
+ mls = MultiLineString ([LineString ([Point (i+ 1 , (i)^ 2 / 6 ), Point (i* 0.75 ,i+ 8 ), Point (i/ 2.5 , i/ 6.79 )]) for i in 5 : 10 ])
627
627
poly = Polygon (Point{2 , Int}[(40 , 40 ), (20 , 45 ), (45 , 30 ), (40 , 40 )])
628
628
geom = [ls... , mls, poly]
629
629
prop = Any[(country_states = " India$(i) " , rainfall = (i* 9 )/ 2 ) for i in 1 : 11 ]
@@ -637,17 +637,14 @@ end
637
637
@test propertynames (sa) === (:main , :country_states , :rainfall )
638
638
@test getproperty (sa, :country_states ) isa Array{Any}
639
639
@test getproperty (sa, :main ) == geom
640
-
641
- @test GeometryBasics. getnamestypes (typeof (feat[1 ])) ==
640
+
641
+ @test GeometryBasics. getnamestypes (typeof (feat[1 ])) ==
642
642
(LineString{2 ,Float64,Point{2 ,Float64},Base. ReinterpretArray{GeometryBasics. Ngon{2 ,Float64,2 ,Point{2 ,Float64}},1 ,Tuple{Point{2 ,Float64},Point{2 ,Float64}},TupleView{Tuple{Point{2 ,Float64},Point{2 ,Float64}},2 ,1 ,Array{Point{2 ,Float64},1 }}}},
643
643
(:country_states , :rainfall ), Tuple{String,Float64})
644
-
645
- @test StructArrays. staticschema (typeof (feat[1 ])) ==
646
- NamedTuple{(:main , :country_states , :rainfall ),Tuple{LineString{2 ,Float64,Point{2 ,Float64},Base. ReinterpretArray{GeometryBasics. Ngon{2 ,Float64,2 ,Point{2 ,Float64}},1 ,Tuple{Point{2 ,Float64},Point{2 ,Float64}},TupleView{Tuple{Point{2 ,Float64},Point{2 ,Float64}},2 ,1 ,Array{Point{2 ,Float64},1 }}}},
647
- String,Float64}}
644
+
648
645
649
646
@test StructArrays. createinstance (typeof (feat[1 ]), LineString ([Point (1 , (2 )^ 2 / 6 ), Point (1 * 0.86 ,6 ), Point (1 / 3 , 1 / 7 )]), " Mumbai" , 100 ) isa typeof (feat[1 ])
650
-
647
+
651
648
@test Base. getindex (feat[1 ], 1 ) isa Line
652
649
@test Base. size (feat[1 ]) == (2 ,)
653
650
end
0 commit comments