diff --git a/pdgstaging/TileStager.py b/pdgstaging/TileStager.py index aec434b..06a358c 100644 --- a/pdgstaging/TileStager.py +++ b/pdgstaging/TileStager.py @@ -391,12 +391,9 @@ def save_tiles(self, gdf=None): f'Saving {len(data.index)} vectors to tile {tile_path}' ) - # Save a copy of the tile column for the summary - tiles = data[self.props['tile']].copy() - # Tile must be a string for saving as attribute data[self.props['tile']] = data[self.props['tile']].astype('str') - tile_strings = data[self.props['tile']].astype('str') + tile_strings = data[self.props['centroid_tile']].astype('str') data[self.props['centroid_tile']] = tile_strings # Open the file in write mode by default @@ -421,8 +418,15 @@ def save_tiles(self, gdf=None): warnings.simplefilter('ignore', FutureWarning) data.to_file(tile_path, mode=mode) + # convert each tile from string format to morecantile format + # so it can be added to summary + # first create series of tiles in str format + tiles_str = data[self.props['tile']].copy() + + tiles_morecantile = [self.tiles.tile_from_str(tile) for tile in tiles_str] + # Record what was saved - data[self.props['tile']] = tiles + data[self.props['tile']] = tiles_morecantile self.summarize(data) finally: # Track the end time, the total time, and the number of vectors