Skip to content

Commit

Permalink
Fix pd.concat error when tiling in WorldCRS84Quad
Browse files Browse the repository at this point in the history
Fixes #11
  • Loading branch information
robyngit committed Nov 22, 2022
1 parent 30400f5 commit d1ab1d4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pdgstaging/TileStager.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,16 @@ def combine_and_deduplicate(self, gdf, tile_path):

dedup_method = self.config.get_deduplication_method()
existing_gdf = gpd.read_file(tile_path)
gdf = pd.concat([gdf, existing_gdf])

# Projection info can be lost during saving & reopening geopackage
# files for the CRS used for some TMSs, see details:
# https://github.com/PermafrostDiscoveryGateway/viz-staging/issues/11
to_concat = [gdf, existing_gdf]
num_unique_crs = len({g.crs for g in to_concat})
if num_unique_crs != 1:
existing_gdf.to_crs(gdf.crs, inplace=True)

gdf = pd.concat(to_concat)
dedup_config = self.config.get_deduplication_config(gdf)
if dedup_method is None:
return gdf
Expand Down

0 comments on commit d1ab1d4

Please sign in to comment.