[gdal-dev] copy features in python ogr

Bobby H. Braswell rob.braswell at unh.edu
Thu Jul 10 10:02:43 EDT 2008


I'm trying to make a script that will read a single-polygon shapefile,  
apply a buffer to the polygon (using shapely) and then write out a new  
file with two polygon features representing the original and the  
buffered region. Rather than creating a new polygon shapefile from  
scratch, I'm wondering if I can just make a copy of the contents of  
the source file (one layer, one feature), add the new feature, then  
write the new contents (one layer, two features) to an output shapefile.

I'm looking at the "CopyLayer" method of the source file, but can't  
seem to get the inputs right, and anyway I'm not sure if that's the  
way to go. Any suggestions would be appreciated.

Thanks very much,
Rob Braswell
University of New Hampshire

More information about the gdal-dev mailing list