Skip to content

Commit

Permalink
Again - small changes to transform
Browse files Browse the repository at this point in the history
  • Loading branch information
fmaussion committed Jul 9, 2024
1 parent 466f9ae commit 46a5889
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion salem/gis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1402,7 +1402,11 @@ def transform_geopandas(gdf, from_crs=None, to_crs=wgs84, inplace=False):
elif isinstance(to_crs, Grid):
to_crs = None
out['geometry'] = result
out.set_crs(to_crs, allow_override=True, inplace=True)
try:
out.set_crs(to_crs, allow_override=True, inplace=True)
except ValueError:
out.crs = to_crs
out.geometry.crs = to_crs
out['min_x'] = [g.bounds[0] for g in out.geometry]
out['max_x'] = [g.bounds[2] for g in out.geometry]
out['min_y'] = [g.bounds[1] for g in out.geometry]
Expand Down

0 comments on commit 46a5889

Please sign in to comment.