<!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> </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> </DIV>
<DIV dir=ltr align=left><FONT face="Courier New" size=2><SPAN
class=574591005-23042009>def
buffer(infile,outfile,buffdist):<BR>
try:<BR>
ds=ogr.Open(infile)<BR>
drv=ds.GetDriver()<BR> if
os.path.exists(outfile):<BR>
drv.DeleteDataSource(outfile)<BR>
drv.CopyDataSource(ds,outfile)<BR>
ds.Destroy()<BR>
<BR>
ds=ogr.Open(outfile,1)<BR>
lyr=ds.GetLayer(0)<BR> for i in
range(0,lyr.GetFeatureCount()):<BR>
feat=lyr.GetFeature(i)<BR>
lyr.DeleteFeature(i)<BR>
geom=feat.GetGeometryRef()<BR>
feat.SetGeometry(geom.Buffer(float(buffdist)))<BR>
lyr.CreateFeature(feat)<BR>
ds.Destroy()<BR> except:return False<BR>
return True</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV dir=ltr align=left><FONT face="Courier New" size=2><SPAN
class=574591005-23042009>if __name__=='__main__':<BR>
usage='usage: buffer <infile> <outfile>
<distance>'<BR> if len(sys.argv) ==
4:<BR> if
buffer(sys.argv[1],sys.argv[2],sys.argv[3]):<BR>
print 'Buffer
succeeded!'<BR>
sys.exit(0)<BR>
else:<BR>
print 'Buffer
failed!'<BR>
sys.exit(1)<BR>
else:<BR> print
usage<BR>
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é <<A href="mailto:randre@gmail.com"
target=_blank>randre@gmail.com</A>> wrote:<BR><BR>> From: Roger André
<<A href="mailto:randre@gmail.com"
target=_blank>randre@gmail.com</A>><BR>> Subject: [gdal-dev] Is it
possible to Buffer using ogr2ogr?<BR>> To: "gdal-dev" <<A
href="mailto:gdal-dev@lists.osgeo.org"
target=_blank>gdal-dev@lists.osgeo.org</A>><BR>> Date: Thursday, April
23, 2009, 4:59 AM<BR>
<DIV>
<DIV></DIV>
<DIV>> Hi All,<BR>><BR>> I'm trying to port some of my existing
PostGIS based<BR>> workflow to ogr utilities and shapefiles. Is it
possible<BR>> to buffer a feature that I've selected via the
ogr2ogr<BR>> "-where" clause? I'd like end up with a<BR>>
single, buffered feature in a stand-alone shapefile when<BR>> I'm
done.<BR>><BR>><BR>> Thanks,<BR>><BR>>
Roger<BR>><BR>><BR></DIV></DIV>> -----Inline Attachment
Follows-----<BR>><BR>>
_______________________________________________<BR>> gdal-dev mailing
list<BR>> <A href="mailto:gdal-dev@lists.osgeo.org"
target=_blank>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><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>