<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16809" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Arial size=2><SPAN 
class=574591005-23042009>Something like the following might get you started 
(note: limited testing and I'm no programmer :)</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial size=2><SPAN 
class=574591005-23042009></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face="Courier New" size=2><SPAN 
class=574591005-23042009>#buffer.py</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face="Courier New" size=2><SPAN 
class=574591005-23042009>import sys,os<BR>from osgeo import 
ogr</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face="Courier New" size=2><SPAN 
class=574591005-23042009>def 
buffer(infile,outfile,buffdist):<BR>&nbsp;&nbsp;&nbsp; 
try:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ds=ogr.Open(infile)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
drv=ds.GetDriver()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if 
os.path.exists(outfile):<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
drv.DeleteDataSource(outfile)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
drv.CopyDataSource(ds,outfile)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ds.Destroy()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ds=ogr.Open(outfile,1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
lyr=ds.GetLayer(0)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for i in 
range(0,lyr.GetFeatureCount()):<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
feat=lyr.GetFeature(i)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
lyr.DeleteFeature(i)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
geom=feat.GetGeometryRef()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
feat.SetGeometry(geom.Buffer(float(buffdist)))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
lyr.CreateFeature(feat)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ds.Destroy()<BR>&nbsp;&nbsp;&nbsp; except:return False<BR>&nbsp;&nbsp;&nbsp; 
return True</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face="Courier New" size=2><SPAN 
class=574591005-23042009>if __name__=='__main__':<BR>&nbsp;&nbsp;&nbsp; 
usage='usage: buffer &lt;infile&gt; &lt;outfile&gt; 
&lt;distance&gt;'<BR>&nbsp;&nbsp;&nbsp; if len(sys.argv) == 
4:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if 
buffer(sys.argv[1],sys.argv[2],sys.argv[3]):<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
print 'Buffer 
succeeded!'<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
sys.exit(0)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
else:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
print 'Buffer 
failed!'<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
sys.exit(1)<BR>&nbsp;&nbsp;&nbsp; 
else:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print 
usage<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
sys.exit(1)<BR></SPAN></FONT></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> gdal-dev-bounces@lists.osgeo.org 
[mailto:gdal-dev-bounces@lists.osgeo.org] <B>On Behalf Of 
</B>Abhay<BR><B>Sent:</B> Thursday, 23 April 2009 1:32 PM<BR><B>To:</B> Roger 
André<BR><B>Cc:</B> gdal-dev@lists.osgeo.org<BR><B>Subject:</B> Re: [gdal-dev] 
Is it possible to Buffer using ogr2ogr?<BR></FONT><BR></DIV>
<DIV></DIV><BR>
<DIV class=gmail_quote>
<BLOCKQUOTE class=gmail_quote 
style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
  <DIV>
  <DIV class=h5>
  <DIV class=gmail_quote>
  <BLOCKQUOTE class=gmail_quote 
  style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">--- 
    On Thu, 4/23/09, Roger André &lt;<A href="mailto:randre@gmail.com" 
    target=_blank>randre@gmail.com</A>&gt; wrote:<BR><BR>&gt; From: Roger André 
    &lt;<A href="mailto:randre@gmail.com" 
    target=_blank>randre@gmail.com</A>&gt;<BR>&gt; Subject: [gdal-dev] Is it 
    possible to Buffer using ogr2ogr?<BR>&gt; To: "gdal-dev" &lt;<A 
    href="mailto:gdal-dev@lists.osgeo.org" 
    target=_blank>gdal-dev@lists.osgeo.org</A>&gt;<BR>&gt; Date: Thursday, April 
    23, 2009, 4:59 AM<BR>
    <DIV>
    <DIV></DIV>
    <DIV>&gt; Hi All,<BR>&gt;<BR>&gt; I'm trying to port some of my existing 
    PostGIS based<BR>&gt; workflow to ogr utilities and shapefiles.&nbsp; Is it 
    possible<BR>&gt; to buffer a feature that I've selected via the 
    ogr2ogr<BR>&gt; "-where" clause?&nbsp; I'd like end up with a<BR>&gt; 
    single, buffered feature in a stand-alone shapefile when<BR>&gt; I'm 
    done.<BR>&gt;<BR>&gt;<BR>&gt; Thanks,<BR>&gt;<BR>&gt; 
    Roger<BR>&gt;<BR>&gt;<BR></DIV></DIV>&gt; -----Inline Attachment 
    Follows-----<BR>&gt;<BR>&gt; 
    _______________________________________________<BR>&gt; gdal-dev mailing 
    list<BR>&gt; <A href="mailto:gdal-dev@lists.osgeo.org" 
    target=_blank>gdal-dev@lists.osgeo.org</A><BR>&gt; <A 
    href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" 
    target=_blank>http://lists.osgeo.org/mailman/listinfo/gdal-dev</A><BR></BLOCKQUOTE></DIV><BR></DIV></DIV><BR>_______________________________________________<BR>gdal-dev 
  mailing list<BR><A 
  href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</A><BR><A 
  href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" 
  target=_blank>http://lists.osgeo.org/mailman/listinfo/gdal-dev</A><BR></BLOCKQUOTE></DIV>
<DIV><BR></DIV>Hi Roger,
<DIV><BR></DIV>
<DIV>I donot think there is way around in the ogr2ogr to create buffer that I 
know of.</DIV>
<DIV><BR></DIV>
<DIV>Instead you will need to write a code in C++ or python to do the 
same.</DIV>
<DIV>Rgds.</DIV>
<DIV>Abhay.</DIV>
<P><br/>------<br/>If you have received this transmission in error please notify us immediately by return e-mail and delete all copies. If this e-mail or any attachments have been sent to you in error, that error does not constitute waiver of any confidentiality, privilege or copyright in respect of information in the e-mail or attachments. <br><br>

Please consider the environment before printing this email.
<br/>------<br/>
</P></BODY></HTML>