Skip to content

Commit

Permalink
Merge pull request #14 from PermafrostDiscoveryGateway/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
julietcohen authored Dec 5, 2022
2 parents 99cfd2e + 5411b17 commit 0bc7c69
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pdgstaging/TileStager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 0bc7c69

Please sign in to comment.