Commit 161be8dc authored by Kris Vanneste's avatar Kris Vanneste
Browse files

Added create_buffer method to MultiData.

git-svn-id: 40b490c5-b4d9-47cb-8714-9bef99b524d5
parent e844382e
......@@ -584,6 +584,35 @@ class MultiData(BasemapData):
## Save and close the data source
def create_buffer(self, distance):
Create buffer around multipoint, multiline or multipolygon feature.
Note: the buffer distance is in the same units as the dataset,
which is normally degrees. If metric distance is required, the
dataset should first be reprojected (not supported) or read
in the native coordinate system!
:param distance:
float, buffer distance (in dataset units)
instance of :class:`PolygonData` or :class:`MultiPolygonData`
from .polygon import PolygonData
buffers = []
for single_data in self:
geom = single_data.to_ogr_geom()
buf = geom.Buffer(distance)
poly = buffers[0]
for buf in buffers[1:]:
poly = poly.Union(buf)
return PolygonData.from_ogr(poly)
def export_ogr(lbm_data, layer_name):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment