@@ -7,6 +7,7 @@ point = GI.Point(1, 2)
7
7
GI. getcoord (point, 1 )
8
8
@test ! GI. ismeasured (point)
9
9
@test ! GI. is3d (point)
10
+ @test GI. ncoord (point) == 2
10
11
@test GI. extent (point) == Extent (X= (1 , 1 ), Y= (2 , 2 ))
11
12
@test point == GI. Point (point)
12
13
@test (GI. x (point), GI. y (point)) == (1 , 2 )
@@ -23,6 +24,7 @@ point_crs = GI.Point(point; crs=EPSG(4326))
23
24
pointz = GI. Point (1 , 2 , 3 )
24
25
@test ! GI. ismeasured (pointz)
25
26
@test GI. is3d (pointz)
27
+ @test GI. ncoord (pointz) == 3
26
28
@test (GI. x (pointz), GI. y (pointz), GI. z (pointz)) == (1 , 2 , 3 )
27
29
@test GI. testgeometry (pointz)
28
30
@test GI. convert (GI, pointz) === pointz
@@ -34,6 +36,7 @@ pointzm = GI.Point(; X=1, Y=2, Z=3, M=4)
34
36
@test pointzm != GI. Point (1 , 2 , 3 )
35
37
@test GI. ismeasured (pointzm)
36
38
@test GI. is3d (pointzm)
39
+ @test GI. ncoord (pointzm) == 4
37
40
@test pointzm == GI. Point (pointzm)
38
41
@test point != GI. Point (pointzm)
39
42
@test (GI. x (pointzm), GI. y (pointzm), GI. z (pointzm), GI. m (pointzm)) == (1 , 2 , 3 , 4 )
@@ -48,6 +51,7 @@ pointm = GI.Point((X=1, Y=2, M=3))
48
51
@test_throws MethodError GI. Point (; X= 1 , Y= 2 , T= 3 )
49
52
@test GI. ismeasured (pointm)
50
53
@test ! GI. is3d (pointm)
54
+ @test GI. ncoord (pointm) == 3
51
55
@test pointm == GI. Point (pointm)
52
56
@test point != GI. Point (pointm)
53
57
@test (GI. x (pointm), GI. y (pointm), GI. m (pointm)) == (1 , 2 , 3 )
@@ -62,6 +66,7 @@ pointtm = GI.Point{false,true}(1, 2, 3)
62
66
@test_throws ArgumentError GI. Point {false,true} (1 , 2 , 3 , 4 )
63
67
@test GI. ismeasured (pointtm)
64
68
@test ! GI. is3d (pointtm)
69
+ @test GI. ncoord (pointtm) == 3
65
70
@test (GI. x (pointtm), GI. y (pointtm), GI. m (pointtm)) == (1 , 2 , 3 )
66
71
@test_throws ArgumentError GI. z (pointtm)
67
72
@test GI. testgeometry (pointtm)
@@ -73,25 +78,29 @@ pointtm_crs = GI.Point{false,true}(1, 2, 3; crs=EPSG(4326))
73
78
pointa = GI. Point ([1 , 2 ])
74
79
@test ! GI. ismeasured (pointa)
75
80
@test ! GI. is3d (pointa)
81
+ @test GI. ncoord (pointa) == 2
76
82
@test (GI. x (pointa), GI. y (pointa)) == (1 , 2 )
77
83
@test GI. testgeometry (pointa)
78
84
79
85
pointaz = GI. Point ([1 , 2 , 3 ])
80
86
@test ! GI. ismeasured (pointaz)
81
87
@test GI. is3d (pointaz)
88
+ @test GI. ncoord (pointaz) == 3
82
89
@test (GI. x (pointaz), GI. y (pointaz), GI. z (pointaz)) == (1 , 2 , 3 )
83
90
@test GI. testgeometry (pointaz)
84
91
85
92
pointazm = GI. Point ([1 , 2 , 3 , 4 ])
86
93
@test GI. ismeasured (pointazm)
87
94
@test GI. is3d (pointazm)
95
+ @test GI. ncoord (pointazm) == 4
88
96
@test (GI. x (pointazm), GI. y (pointazm), GI. z (pointazm), GI. m (pointazm)) == (1 , 2 , 3 , 4 )
89
97
@test GI. testgeometry (pointazm)
90
98
91
99
# We can force a vector point to be measured
92
100
pointam = GI. Point {false,true} ([1 , 2 , 3 ])
93
101
@test GI. ismeasured (pointam)
94
102
@test ! GI. is3d (pointam)
103
+ @test GI. ncoord (pointam) == 3
95
104
@test (GI. x (pointam), GI. y (pointam), GI. m (pointam)) == (1 , 2 , 3 )
96
105
@test_throws ArgumentError GI. z (pointam)
97
106
@test GI. testgeometry (pointam)
@@ -104,6 +113,7 @@ line = GI.Line([(1, 2), (3, 4)])
104
113
@test GI. getgeom (line) == [(1 , 2 ), (3 , 4 )]
105
114
@test GI. testgeometry (line)
106
115
@test ! GI. is3d (line)
116
+ @test GI. ncoord (line) == 2
107
117
@test GI. extent (line) == Extent (X= (1 , 3 ), Y= (2 , 4 ))
108
118
@test_throws ArgumentError GI. Line (point)
109
119
@test_throws ArgumentError GI. Line ([(1 , 2 )])
@@ -119,6 +129,7 @@ linestring = GI.LineString([(1, 2), (3, 4)])
119
129
@test GI. getgeom (linestring) == [(1 , 2 ), (3 , 4 )]
120
130
@test GI. testgeometry (linestring)
121
131
@test ! GI. is3d (linestring)
132
+ @test GI. ncoord (linestring) == 2
122
133
@test @inferred (GI. extent (linestring)) == Extent (X= (1 , 3 ), Y= (2 , 4 ))
123
134
@test_throws ArgumentError GI. LineString ([(1 , 2 )])
124
135
linestring_crs = GI. LineString (linestring; crs= EPSG (4326 ))
@@ -132,6 +143,7 @@ linearring = GI.LinearRing([(1, 2), (3, 4), (5, 6), (1, 2)])
132
143
@test GI. getgeom (linearring) == [(1 , 2 ), (3 , 4 ), (5 , 6 ), (1 , 2 )]
133
144
@test GI. testgeometry (linearring)
134
145
@test ! GI. is3d (linearring)
146
+ @test GI. ncoord (linearring) == 2
135
147
@test @inferred (GI. extent (linearring)) == Extent (X= (1 , 5 ), Y= (2 , 6 ))
136
148
@test_throws ArgumentError GI. LinearRing ([(1 , 2 )])
137
149
linearring_crs = GI. LinearRing (linearring; crs= EPSG (4326 ))
@@ -146,6 +158,7 @@ polygon = GI.Polygon([linearring, linearring])
146
158
@test collect (GI. getpoint (polygon)) == vcat (collect (GI. getpoint (linearring)), collect (GI. getpoint (linearring)))
147
159
@test GI. testgeometry (polygon)
148
160
@test ! GI. is3d (polygon)
161
+ @test GI. ncoord (polygon) == 2
149
162
@test @inferred (GI. extent (polygon)) == Extent (X= (1 , 5 ), Y= (2 , 6 ))
150
163
@test GI. convert (GI, MyPolygon ()) isa GI. Polygon
151
164
@test GI. convert (GI, polygon) === polygon
@@ -160,13 +173,15 @@ polygon = GI.Polygon([linestring, linestring])
160
173
linearring3d = GI. LinearRing ([(1 , 2 , 3 ), (3 , 4 , 5 ), (5 , 6 , 7 ), (1 , 2 , 3 )])
161
174
polygon3d = GI. Polygon ([linearring3d, linearring3d])
162
175
@test GI. is3d (polygon3d)
176
+ @test GI. ncoord (polygon3d) == 3
163
177
@test GI. extent (polygon3d) == Extents. Extent (X= (1 , 5 ), Y= (2 , 6 ), Z= (3 , 7 ))
164
178
165
179
# MultiPoint
166
180
multipoint = GI. MultiPoint ([(1 , 2 ), (3 , 4 ), (3 , 2 ), (1 , 4 ), (7 , 8 ), (9 , 10 )])
167
181
@test multipoint == GI. MultiPoint (multipoint)
168
182
@test GI. getgeom (multipoint, 1 ) === (1 , 2 )
169
183
@test ! GI. is3d (multipoint)
184
+ @test GI. ncoord (multipoint) == 2
170
185
@test @inferred (GI. extent (multipoint)) == Extent (X= (1 , 9 ), Y= (2 , 10 ))
171
186
@test_throws ArgumentError GI. MultiPoint ([[(1 , 2 ), (3 , 4 ), (3 , 2 ), (1 , 4 ), (7 , 8 ), (9 , 10 )]])
172
187
@test GI. testgeometry (multipoint)
@@ -181,6 +196,7 @@ collection = GI.GeometryCollection(geoms)
181
196
@test GI. getgeom (collection) == geoms
182
197
@test GI. testgeometry (collection)
183
198
@test ! GI. is3d (collection)
199
+ @test GI. ncoord (collection) == 2
184
200
@test GI. extent (collection) == reduce (Extents. union, map (GI. extent, geoms))
185
201
collection_crs = GI. GeometryCollection (collection; crs= EPSG (4326 ))
186
202
@test parent (collection_crs) == parent (collection)
@@ -192,6 +208,7 @@ multicurve = GI.MultiCurve([linestring, linearring])
192
208
@test multicurve == GI. MultiCurve (multicurve)
193
209
@test GI. getgeom (multicurve, 1 ) === linestring
194
210
@test ! GI. is3d (multicurve)
211
+ @test GI. ncoord (multicurve) == 2
195
212
@test GI. extent (multicurve) == Extent (X= (1 , 5 ), Y= (2 , 6 ))
196
213
@test_throws ArgumentError GI. MultiCurve ([pointz, polygon])
197
214
@test GI. testgeometry (multicurve)
@@ -206,6 +223,7 @@ multipolygon = GI.MultiPolygon([polygon])
206
223
@test multipolygon == GI. MultiPolygon (multipolygon)
207
224
@test GI. getgeom (multipolygon, 1 ) === polygon
208
225
@test ! GI. is3d (multipolygon)
226
+ @test GI. ncoord (multipolygon) == 2
209
227
@show polygon
210
228
@show GI. getgeom (polygon, 1 )
211
229
# MultiPolygon extent does not infer, maybe due to nesting
@@ -221,6 +239,7 @@ multipolygon_crs = GI.MultiPolygon(multipolygon; crs=EPSG(4326))
221
239
polyhedralsurface = GI. PolyhedralSurface ([polygon, polygon])
222
240
@test polyhedralsurface == GI. PolyhedralSurface (polyhedralsurface)
223
241
@test ! GI. is3d (polyhedralsurface)
242
+ @test GI. ncoord (polyhedralsurface) == 2
224
243
@test @inferred (GI. extent (polyhedralsurface)) == Extent (X= (1 , 5 ), Y= (2 , 6 ))
225
244
@test GI. getgeom (polyhedralsurface, 1 ) === polygon
226
245
@test collect (GI. getgeom (polyhedralsurface)) == [polygon, polygon]
0 commit comments