@@ -263,7 +263,7 @@ def smart_repair(geometries_df, snapped=True, snap_precision=9, fill_gaps=True,
263
263
c_ind = component_areas_sorted [i ][0 ]
264
264
this_fragment = reconstructed_df .loc [g_ind , "geometry" ].geoms [c_ind ]
265
265
if component_areas_sorted [i ][1 ] < disconnection_threshold * big_area :
266
- possible_intersect_integer_indices = [ * set (numpy . ndarray . flatten ( spatial_index .query (this_fragment )))]
266
+ possible_intersect_integer_indices = list ( set (spatial_index .query (this_fragment ). ravel ()))
267
267
possible_intersect_indices = [(index_by_iloc [k ]) for k in possible_intersect_integer_indices ]
268
268
269
269
if nest_within_regions is not None :
@@ -415,7 +415,7 @@ def building_blocks(geometries_df, snap_magnitude=None, nest_within_regions=None
415
415
# Note that "None" is a possibility, and that each piece will belong to a unique
416
416
# region because the regions GeoDataFrame/GeoSeries MUST be clean.
417
417
if nest_within_regions is not None :
418
- possible_region_integer_indices = [ * set (numpy . ndarray . flatten ( r_spatial_index .query (pieces_df .loc [i , "geometry" ])))]
418
+ possible_region_integer_indices = list ( set (r_spatial_index .query (pieces_df .loc [i , "geometry" ]). ravel ()))
419
419
possible_region_indices = [r_index_by_iloc [k ] for k in possible_region_integer_indices ]
420
420
421
421
for j in possible_region_indices :
@@ -426,7 +426,7 @@ def building_blocks(geometries_df, snap_magnitude=None, nest_within_regions=None
426
426
# contained in. If region boundaries are included, then while determining which
427
427
# geometries each piece is contained in, omit any geometries that are
428
428
# assigned to a region other than the one the piece is contained in.
429
- possible_geom_integer_indices = [ * set (numpy . ndarray . flatten ( g_spatial_index .query (pieces_df .loc [i , "geometry" ])))]
429
+ possible_geom_integer_indices = list ( set (g_spatial_index .query (pieces_df .loc [i , "geometry" ]). ravel ()))
430
430
possible_geom_indices = [g_index_by_iloc [k ] for k in possible_geom_integer_indices ]
431
431
432
432
for j in possible_geom_indices :
@@ -558,7 +558,7 @@ def reconstruct_from_overlap_tower(geometries_df, overlap_tower, nested=False):
558
558
o_index_by_iloc = dict ((i , list (overlaps_df .index )[i ]) for i in range (len (overlaps_df )))
559
559
560
560
for g_ind in geometries_disconnected_df .index :
561
- possible_overlap_integer_indices = [ * set (numpy . ndarray . flatten ( o_spatial_index .query (geometries_disconnected_df .loc [g_ind , "geometry" ])))]
561
+ possible_overlap_integer_indices = list ( set (o_spatial_index .query (geometries_disconnected_df .loc [g_ind , "geometry" ]). ravel ()))
562
562
possible_overlap_indices_0 = [o_index_by_iloc [k ] for k in possible_overlap_integer_indices ]
563
563
possible_overlap_indices = list (set (possible_overlap_indices_0 ) & set (overlaps_df_unused_indices ))
564
564
@@ -593,7 +593,7 @@ def reconstruct_from_overlap_tower(geometries_df, overlap_tower, nested=False):
593
593
for o_ind in overlaps_df_unused_indices :
594
594
this_overlap = overlaps_df .loc [o_ind , "geometry" ]
595
595
shared_perimeters = []
596
- possible_geom_integer_indices = [ * set (numpy . ndarray . flatten ( g_spatial_index .query (this_overlap )))]
596
+ possible_geom_integer_indices = list ( set (g_spatial_index .query (this_overlap ). ravel ()))
597
597
possible_geom_indices = [g_index_by_iloc [k ] for k in possible_geom_integer_indices ]
598
598
599
599
for g_ind in possible_geom_indices :
@@ -616,7 +616,7 @@ def reconstruct_from_overlap_tower(geometries_df, overlap_tower, nested=False):
616
616
this_overlap = orphaned_overlaps [o_ind ][0 ]
617
617
this_overlap_polygon_indices = orphaned_overlaps [o_ind ][1 ]
618
618
shared_perimeters = []
619
- possible_geom_integer_indices = [ * set (numpy . ndarray . flatten ( g_spatial_index .query (this_overlap )))]
619
+ possible_geom_integer_indices = list ( set (g_spatial_index .query (this_overlap ). ravel ()))
620
620
possible_geom_indices = [g_index_by_iloc [k ] for k in possible_geom_integer_indices ]
621
621
622
622
for g_ind in possible_geom_indices :
@@ -653,7 +653,7 @@ def drop_bad_holes(reconstructed_df, holes_df, fill_gaps_threshold):
653
653
hole_indices_to_drop_aat = []
654
654
for h_ind in holes_df .index :
655
655
this_hole = holes_df .loc [h_ind , "geometry" ]
656
- possible_intersect_integer_indices = [ * set (numpy . ndarray . flatten ( spatial_index .query (this_hole )))]
656
+ possible_intersect_integer_indices = list ( set (spatial_index .query (this_hole ). ravel ()))
657
657
possible_intersect_indices = [(index_by_iloc [k ]) for k in possible_intersect_integer_indices ]
658
658
actual_intersect_indices = [g_ind for g_ind in possible_intersect_indices if not this_hole .intersection (reconstructed_df .loc [g_ind , "geometry" ]).is_empty ]
659
659
@@ -1211,7 +1211,7 @@ def small_rook_to_queen(geometries_df, min_rook_length):
1211
1211
poly_to_remove = polys_to_remove_list [a_ind ]
1212
1212
1213
1213
# Identify geometries that might intersect this polygon.
1214
- possible_geom_integer_indices = [ * set (numpy . ndarray . flatten ( g_spatial_index .query (poly_to_remove )))]
1214
+ possible_geom_integer_indices = list ( set (g_spatial_index .query (poly_to_remove ). ravel ()))
1215
1215
possible_geom_indices = [g_index_by_iloc [k ] for k in possible_geom_integer_indices ]
1216
1216
1217
1217
# Use the boundaries of these geometries together with the boundary of the disk to
@@ -1236,7 +1236,7 @@ def small_rook_to_queen(geometries_df, min_rook_length):
1236
1236
pieces_df ["polygon indices" ] = [set () for x in range (len (pieces_df .index ))]
1237
1237
1238
1238
for i in pieces_df .index :
1239
- temp_possible_geom_integer_indices = [ * set (numpy . ndarray . flatten ( g_spatial_index .query (pieces_df .loc [i , "geometry" ])))]
1239
+ temp_possible_geom_integer_indices = list ( set (g_spatial_index .query (pieces_df .loc [i , "geometry" ]). ravel ()))
1240
1240
temp_possible_geom_indices = [g_index_by_iloc [k ] for k in temp_possible_geom_integer_indices ]
1241
1241
1242
1242
for j in temp_possible_geom_indices :
@@ -1327,7 +1327,7 @@ def construct_hole_boundaries(geometries_df, holes_df):
1327
1327
this_hole_segments = segments (this_hole .boundary )
1328
1328
this_hole_segments_used = []
1329
1329
1330
- possible_geom_integer_indices = [ * set (numpy . ndarray . flatten ( g_spatial_index .query (holes_df .loc [h_ind , "geometry" ])))]
1330
+ possible_geom_integer_indices = list ( set (g_spatial_index .query (holes_df .loc [h_ind , "geometry" ]). ravel ()))
1331
1331
possible_geom_indices = [g_index_by_iloc [k ] for k in possible_geom_integer_indices ]
1332
1332
1333
1333
for g_ind in possible_geom_indices :
0 commit comments