I would like to create one-sided buffer geometries around linestrings. I found this ST_SingleSidedBuffer SpatialLite function that I would like to use in my Python script.
When I run the function below, the
bufferFeature is empty without throwing any error. Is this because I am using an incorrect syntax or because the
ST_functions cannot be run without setting up a database? I am accessing my data with OGR/GDAL functions.
I couldn't find complete examples online to compare my syntax with, only small snippets from GDAL on spatialite SQL functions, as well as further ones that seem to require a database connection: stack exchange: How to use SpatiaLite functions in a Python script?
def createBuffer(self, datasource, layer, bufferDistance, side): [...] for feature in layer: geometry = feature.GetGeometryRef() sqlQuerry = "SELECT ST_SingleSidedBuffer(%s, %.2f , %i) * FROM %s" \ % (geometry, bufferDistance, side, layer.GetName()) bufferFeature = datasource.ExecuteSQL(sqlQuerry, None, 'SQLite') #syntax: ExecuteSQL(statement, [spatialFiler], [dialect])