@@ -59,6 +59,8 @@ def test_point_invalid_coordinates(coordinates):
59
59
[(1.0 , 2.0 ), (1.0 , 2.0 )],
60
60
# Has Z
61
61
[(1.0 , 2.0 , 3.0 ), (1.0 , 2.0 , 3.0 )],
62
+ # Mixed
63
+ [(1.0 , 2.0 ), (1.0 , 2.0 , 3.0 )],
62
64
],
63
65
)
64
66
def test_multi_point_valid_coordinates (coordinates ):
@@ -93,6 +95,7 @@ def test_multi_point_invalid_coordinates(coordinates):
93
95
[(1.0 , 2.0 ), (3.0 , 4.0 ), (5.0 , 6.0 )],
94
96
# Two Points, has Z
95
97
[(0.0 , 0.0 , 0.0 ), (1.0 , 1.0 , 1.0 )],
98
+ # Shapely doesn't like mixed here
96
99
],
97
100
)
98
101
def test_line_string_valid_coordinates (coordinates ):
@@ -130,6 +133,8 @@ def test_line_string_invalid_coordinates(coordinates):
130
133
[[(1.0 , 2.0 ), (3.0 , 4.0 )], [(0.0 , 0.0 ), (1.0 , 1.0 )]],
131
134
# Two lines, two points each, has Z
132
135
[[(1.0 , 2.0 , 0.0 ), (3.0 , 4.0 , 1.0 )], [(0.0 , 0.0 , 0.0 ), (1.0 , 1.0 , 1.0 )]],
136
+ # Mixed
137
+ [[(1.0 , 2.0 ), (3.0 , 4.0 )], [(0.0 , 0.0 , 0.0 ), (1.0 , 1.0 , 1.0 )]],
133
138
],
134
139
)
135
140
def test_multi_line_string_valid_coordinates (coordinates ):
@@ -206,6 +211,17 @@ def test_polygon_valid_coordinates(coordinates):
206
211
(2.0 , 2.0 , 1.0 ),
207
212
],
208
213
],
214
+ # Mixed
215
+ [
216
+ [(0.0 , 0.0 ), (0.0 , 10.0 ), (10.0 , 10.0 ), (10.0 , 0.0 ), (0.0 , 0.0 )],
217
+ [
218
+ (2.0 , 2.0 , 2.0 ),
219
+ (2.0 , 4.0 , 0.0 ),
220
+ (4.0 , 4.0 , 0.0 ),
221
+ (4.0 , 2.0 , 0.0 ),
222
+ (2.0 , 2.0 , 2.0 ),
223
+ ],
224
+ ],
209
225
],
210
226
)
211
227
def test_polygon_with_holes (coordinates ):
@@ -271,6 +287,19 @@ def test_polygon_invalid_coordinates(coordinates):
271
287
],
272
288
]
273
289
],
290
+ # Mixed
291
+ [
292
+ [
293
+ [(0.0 , 0.0 ), (1.0 , 0.0 ), (1.0 , 1.0 ), (0.0 , 1.0 ), (0.0 , 0.0 )],
294
+ [
295
+ (2.1 , 2.1 , 2.1 ),
296
+ (2.2 , 2.1 , 2.0 ),
297
+ (2.2 , 2.2 , 2.2 ),
298
+ (2.1 , 2.2 , 2.3 ),
299
+ (2.1 , 2.1 , 2.1 ),
300
+ ],
301
+ ]
302
+ ],
274
303
],
275
304
)
276
305
def test_multi_polygon (coordinates ):
@@ -452,6 +481,18 @@ def test_getitem_geometry_collection(polygon):
452
481
assert item == gc [0 ]
453
482
454
483
484
+ def test_wkt_mixed_geometry_collection ():
485
+ point = Point (type = "Point" , coordinates = (0.0 , 0.0 , 0.0 ))
486
+ line_string = LineString (type = "LineString" , coordinates = [(0.0 , 0.0 ), (1.0 , 1.0 )])
487
+ gc = GeometryCollection (type = "GeometryCollection" , geometries = [point , line_string ])
488
+ assert_wkt_equivalence (gc )
489
+
490
+
491
+ def test_wkt_empty_geometry_collection ():
492
+ gc = GeometryCollection (type = "GeometryCollection" , geometries = [])
493
+ assert_wkt_equivalence (gc )
494
+
495
+
455
496
def test_polygon_from_bounds ():
456
497
"""Result from `from_bounds` class method should be the same."""
457
498
coordinates = [[(1.0 , 2.0 ), (3.0 , 2.0 ), (3.0 , 4.0 ), (1.0 , 4.0 ), (1.0 , 2.0 )]]
0 commit comments