Return to Snippet

Revision: 58943
at August 10, 2012 06:51 by mbsweng2


Initial Code
#now open the shapefile
shp = ogr.Open(shpfile)

drv = shp.GetDriver()
drv.CopyDataSource(shp, buffile)

shp.Destroy()

buf = ogr.Open(buffile, 1)
lyr = buf.GetLayer(0)

for i in range(0, lyr.GetFeatureCount()):
	feat = lyr.GetFeature(i)
	lyr.DeleteFeature(i)
	geom = feat.GetGeometryRef()
	feat.SetGeometry(geom.Buffer(1000.0))
	lyr.CreateFeature(feat)

buf.Destroy()

Initial URL


Initial Description
create buffer polygon from shapefile

Initial Title
create buffer using gdal in python

Initial Tags


Initial Language
Python