Skip to content

Commit

Permalink
allow passing Polygons or LineStrings as map-boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelquast committed Aug 28, 2024
1 parent 3e76ec0 commit 02485a0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion eomaps/eomaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -1267,12 +1267,18 @@ def set_extent_to_location(self, location, annotate=False, user_agent=None):
_log.info(f"Centering Map to:\n {r['display_name']}")

def _set_gdf_path_boundary(self, gdf, set_extent=True):
geom = gdf.to_crs(self.crs_plot).unary_union.boundary
geom = gdf.to_crs(self.crs_plot).unary_union
if "Polygon" in geom.geom_type:
geom = geom.boundary

if geom.geom_type == "MultiLineString":
boundary_linestrings = geom.geoms
elif geom.geom_type == "LineString":
boundary_linestrings = [geom]
else:
raise TypeError(
f"Geometries of type {geom.type} cannot be used as map-boundary."
)

vertices, codes = [], []
for g in boundary_linestrings:
Expand Down

0 comments on commit 02485a0

Please sign in to comment.