3

I'm having some issues with QGIS 2.14 Essen (all of the versions...). Specifically, I'm trying to do a buffer on a vector layer using the "Buffer Vectors" tool from the processing toolbox (ogr2ogr).

My layer is called "buffertest.shp", and contains 2 polygons. I'm using the default options, buffer distance of 1000 (Using CRS 27700, so it's 1000m), saving output as a temporary file. The console call is:

ogr2ogr.exe "\"[temporary file]\"" C:/Users/Skipper/Desktop/buffertest.shp buffertest -dialect sqlite -sql "SELECT ST_Buffer( geometry , 1000 ),* FROM 'buffertest' "

So far so good.

When the command is run, get a lovely message in the tool log saying:

cmd.exe /C ogr2ogr.exe "C:\Users\Skipper\AppData\Local\Temp\processing0c9922510f974f0eb4b34b3af7a0f9f6\9a2f675c807343c19e3a58fd66848382\OUTPUTLAYER.shp" C:\Users\Skipper\AppData\Local\Temp\processing0c9922510f974f0eb4b34b3af7a0f9f6\1476169842.153.shp 1476169842.153 -dialect sqlite -sql "SELECT ST_Buffer( geometry , 1000 ),* FROM 'buffertest' " 
GDAL command output:
Warning 1: layer names ignored in combination with -sql. 
ERROR 1: In ExecuteSQL(): sqlite3_prepare(SELECT ST_Buffer( geometry , 1000 ),* FROM 'buffertest' ): 
no such table: buffertest 
Converting outputs
Loading resulting layers

The following layers were not correctly generated.

Buffer

You can check the log messages to find more information about the execution of the algorithm

Which isn't ideal. No layer created, just the error there. The log in the Log Messages Panel is the same, with the addition of QGIS saying it can't load the layer, because it doesn't exist.


Running the command through OSGEO4W shell works fine - gives the error:

Warning 1: layer names ignored in combination with -sql

But generates the right output.

3
  • what's your question?
    – nmtoken
    Commented Oct 11, 2016 at 7:42
  • Message is only warning but if you want to get rid of it just leave out the unnecessary layer name and use just "buffertest.shp". I do not know the internals of QGIS but it seems to use another temporary file as input C:\Users\Skipper\AppData\Local\Temp\processing0c9922510f974f0eb4b34b3af7a0f9f6\1476169842.153.shp 1476169842.153 I do not know if the number string converts somehow into "buffertest". If not, it is no wonder that GDAL does not find the layer.
    – user30184
    Commented Oct 11, 2016 at 7:51
  • The message log is showing a different command to what was generated in the tool menu/console call. I am assuming it is using the temporary file, instead of the buffertest.shp, which yea, would explain why it can't find it, but why is it switching over from a command that would work fine, to some random gibberish?
    – Skipper
    Commented Oct 11, 2016 at 8:32

1 Answer 1

2

Give the temporary output file a name to avoid errors with numerical filenames and layer names.

See Is starting names with numbers a bad data naming convention? and What are Valid feature class and table names in ArcGIS Desktop?

It seems to be a bug in processing worth reporting, but you should test with the latest qgis master to see if it is already fixed.

Testing in QGIS 2.16.3, I get this log:

Algorithm Buffer vectors starting...
GDAL command:
cmd.exe /C ogr2ogr.exe "C:\Users\INTERN~1\AppData\Local\Temp\processing88ef336fcd844b358232b4987e80b92b\33a81551b46a41e78c3b9c902952d7a7\OUTPUTLAYER.shp" C:\Users\INTERN~1\AppData\Local\Temp\processing88ef336fcd844b358232b4987e80b92b\44d3d39644374050a42d2625c902c7ec\buffertest.shp buffertest -dialect sqlite -sql "SELECT ST_Buffer( geometry , 1000 ),* FROM 'buffertest' "
GDAL command output:
Warning 1: layer names ignored in combination with -sql. 
Converting outputs
Loading resulting layers
Algorithm Buffer vectors finished

Trying the same with QGIS 2.14.4, I get

splitext() takes exactly 1 argument (0 given) See log for more details

even with a given filename, and no output. This has been reported and fixed in https://hub.qgis.org/issues/15320

So there seems to have been some work on the module already, and I suggest to update.

2
  • I'm using 2.14.7. Have tried giving the output a name (bufferoutputtest.shp) - same error, and no geometry created. Will try with the latest version (rather than LTR), and see if that does anything.
    – Skipper
    Commented Oct 11, 2016 at 8:26
  • I tried it with 2.16.3. With a memory/scratch layer, it gave a similar error, if I saved and imported the memory layer (as a shapefile) , it works straight away... Seems to just be a bug with 2.14. Nice one!
    – Skipper
    Commented Oct 11, 2016 at 9:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.