Skip to content

Commit

Permalink
fix(gis): repair buffering and simplifying
Browse files Browse the repository at this point in the history
  • Loading branch information
j-haacker committed Mar 28, 2024
1 parent 194c3ae commit 1da1e48
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cryoswath/gis.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ def buffer_4326_shp(shp: shapely.Geometry, radius: float, simplify: bool = True)
except AttributeError:
buffered_planar = \
gpd.GeoSeries(shp, crs=4326).to_crs(planar_crs).buffer(0).simplify(100).buffer(radius)
if simplify: return buffered_planar.simplify(radius/2).to_crs(4326).iloc[0]
return buffered_planar.to_crs(4326).unary_union #.iloc[0]
if simplify:
return buffered_planar.simplify(radius/3).to_crs(4326).unary_union
return buffered_planar.to_crs(4326).unary_union
__all__.append("buffer_4326_shp")


Expand Down Expand Up @@ -115,6 +116,6 @@ def simplify_4326_shp(shp: shapely.Geometry, tolerance: float = None) -> shapely
else:
tolerance = 300
planar_crs = find_planar_crs(shp=shp)
return gpd.GeoSeries(shp, crs=4326).to_crs(planar_crs).simplify(tolerance).to_crs(4326).iloc[0]
return gpd.GeoSeries(shp, crs=4326).to_crs(planar_crs).simplify(tolerance).to_crs(4326).unary_union
__all__.append("simplify_4326_shp")

0 comments on commit 1da1e48

Please sign in to comment.