Implement envelope method as a unary operator

This commit is contained in:
Kelsey Jordahl committed 2013-06-30 18:34:25 -04:00
1 parent 6f87ae9319
commit d09c8ca07b
1 file changed
+9 -1
+9 -1
View File
@@ -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