[gdal-dev] Buffering Right and Buffering Left Using Gdal/OGR

Jukka Rahkonen jukka.rahkonen at mmmtike.fi
Tue Dec 30 12:24:53 PST 2014


Pratap Chelamilla <pratap.chelamilla <at> amigooptima.in> writes:

> 
> 
> Hi,
> I am trying to buffer polyline to its right / left , Is there any way to
buffer right/left using GDAL/OGR.        OGRGeometry *bufGeometry =
geometry->Buffer(buffer);
> I have tried providing buffer value with positive and negative, but 
unable to see any buffering around the polyline.Please provideus solution to
solve this problem. -- Regards,Pratap.

Hi,

I believe that if GDAL is compiled with a brand new Spatialite that contains
SingleSidedBuffer function it should be doable with SQLite SQL dialect.

I tested that this works with a Windows build from gisinternals:

ogrinfo foo.sqlite -sql "select buffer(geomfromtext('linestring
 (0 0, 1 1)'),1)"
INFO: Open of `foo.sqlite'
      using driver `SQLite' successful.

Layer name: SELECT
Geometry: Unknown (any)
Feature Count: 1
Extent: (-1.000000, -1.000000) - (2.000000, 2.000000)
Layer SRS WKT:
(unknown)
Geometry Column = buffer(geomfromtext('linestring (0 0, 1 1)'),1)
OGRFeature(SELECT):0
  POLYGON ((0.292893218813453 1.707106781186548,0.330869393641143 1.743144825477
395,0.370679608950164 1.777145961456972,0.412214747707528 1.809016994374948,0.45

This build gives an error with SingleSidedBuffer:
 no such function: SingleSidedBuffer

However, with recent Spatialite-gui I can do with success:
select singlesidedbuffer(geometryfromtext('LINESTRING (0 0, 1 1)'),1,-1)

-Jukka Rahkonen-






More information about the gdal-dev mailing list