mirror of
https://github.com/wassname/geopandas.git
synced 2026-10-03 12:31:14 +08:00
Implement envelope method as a unary operator
This commit is contained in:
1 parent
6f87ae9319
commit
d09c8ca07b
1 file changed
+9
-1
@@ -109,6 +109,13 @@ class GeoSeries(Series):
|
||||
return Series([getattr(s, op)(other) for s in self],
|
||||
index=self.index)
|
||||
|
||||
def _geo_unary_op(self, op):
|
||||
"""
|
||||
Unary operation that returns a GeoSeries
|
||||
"""
|
||||
return GeoSeries([getattr(geom, op) for geom in self],
|
||||
index=self.index)
|
||||
|
||||
@property
|
||||
def area(self):
|
||||
"""
|
||||
@@ -251,8 +258,9 @@ class GeoSeries(Series):
|
||||
return GeoSeries([geom.buffer(distance, resolution) for geom in self],
|
||||
index=self.index)
|
||||
|
||||
@property
|
||||
def envelope(self):
|
||||
raise NotImplementedError
|
||||
return self._geo_unary_op('envelope')
|
||||
|
||||
def exterior(self):
|
||||
raise NotImplementedError
|
||||
|
||||
Reference in new issue
Block a user