File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -253,9 +253,14 @@ def _save_shapes_to_sdata(
253253 np .array ([layer_to_save .data_to_world (xy ) for xy in shape ._data ])
254254 for shape in layer_to_save ._data_view .shapes
255255 ]
256- remove_z = coords [0 ].shape [1 ] == 3
257- first_index = 1 if remove_z else 0
258- polygons : list [Polygon ] = [Polygon (p [::- 1 , first_index :]) for p in coords ]
256+
257+ def _fix_coords (coords : np .ndarray ) -> np .ndarray :
258+ remove_z = coords .shape [1 ] == 3
259+ first_index = 1 if remove_z else 0
260+ coords = coords [:, first_index ::]
261+ return np .fliplr (coords )
262+
263+ polygons : list [Polygon ] = [Polygon (_fix_coords (p )) for p in coords ]
259264 # polygons: list[Polygon] = [Polygon(i) for i in _transform_coordinates(coords, f=lambda x: x[::-1])]
260265 # polygons: list[Polygon] = [Polygon(i) for i in _transform_coordinates(layer_to_save.data, f=lambda x: x[::-1])]
261266 gdf = GeoDataFrame ({"geometry" : polygons })
You can’t perform that action at this time.
0 commit comments