Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OGR processing of scratch layers doesn't work #25185

Closed
qgib opened this issue Oct 15, 2017 · 12 comments
Closed

OGR processing of scratch layers doesn't work #25185

qgib opened this issue Oct 15, 2017 · 12 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms Regression Something which used to work, but doesn't anymore

Comments

@qgib
Copy link
Contributor

qgib commented Oct 15, 2017

Author Name: Tobias Wendorff (Tobias Wendorff)
Original Redmine Issue: 17287
Affected QGIS version: 2.18.13
Redmine category:processing/ogr
Assignee: Giovanni Manghi


I've created a point on a scratch layer (EPSG:4326) and want to create an ogr2ogr buffer using "processing".
The result is an error, as you can see on the animated gif attached.


@qgib
Copy link
Contributor Author

qgib commented Oct 15, 2017

Author Name: Tobias Wendorff (Tobias Wendorff)


Copy of the error message:

Algorithm 'Buffer vectors' starting...
Input parameters:
{ 'INPUT' : 'Point?crs=EPSG:4326&uid={fb3f5b3a-77ef-461f-876b-8e13f9e20cf4}', 'GEOMETRY' : 'geometry', 'DISTANCE' : 10, 'FIELD' : '', 'DISSOLVE' : False, 'EXPLODE_COLLECTIONS' : False, 'OPTIONS' : '', 'OUTPUT' : 'C:/Users/test/AppData/Local/Temp/processing_b3eeb99e5a0c4e5f990f7c7b7d49a8d6/beb3eb9ca76546efa9be8f327ce40fa4/OUTPUT.shp' }

GDAL command:
ogr2ogr "C:/Users/test/AppData/Local/Temp/processing_b3eeb99e5a0c4e5f990f7c7b7d49a8d6/beb3eb9ca76546efa9be8f327ce40fa4/OUTPUT.shp" C:/Users/test/AppData/Local/Temp/processing_b3eeb99e5a0c4e5f990f7c7b7d49a8d6/0db7b207ed4a459799cd887f39ac6a98/INPUT.shp -dialect sqlite -sql "SELECT ST_Union(ST_Buffer(geometry, 10.0)) AS geometry, FROM 'INPUT'" -f "ESRI Shapefile"
GDAL command output:
ERROR 1: In ExecuteSQL(): sqlite3_prepare_v2(SELECT ST_Union(ST_Buffer(geometry, 10.0)) AS geometry, FROM 'INPUT'): 
near "FROM": syntax error 
Execution completed in 0.64 seconds
Results:
{'OUTPUT': <QgsProcessingOutputLayerDefinition {'sink':C:/Users/test/AppData/Local/Temp/processing_b3eeb99e5a0c4e5f990f7c7b7d49a8d6/beb3eb9ca76546efa9be8f327ce40fa4/OUTPUT.shp, 'createOptions': {'fileEncoding': 'System'}}>}

Loading resulting layers
Algorithm 'Buffer vectors' finished

Seems like the comma is wrong :)

@qgib
Copy link
Contributor Author

qgib commented Oct 15, 2017

Author Name: Tobias Wendorff (Tobias Wendorff)


Argh... of course the comma is wrong. It expects a field! But this isn't needed...

@qgib
Copy link
Contributor Author

qgib commented Oct 15, 2017

Author Name: Nyall Dawson (@nyalldawson)


Does it work correctly if you add a field to the memory layer?

I suspect this issue isn't related to the use of a memory layer, but rather that the algorithms don't work correctly with layers with no fields. In which case it's likely also an issue in 2.x


  • status_id was changed from Open to Feedback

@qgib
Copy link
Contributor Author

qgib commented Oct 16, 2017

Author Name: Tobias Wendorff (Tobias Wendorff)


Nyall Dawson wrote:

Does it work correctly if you add a field to the memory layer?

Yes it does.

I suspect this issue isn't related to the use of a memory layer, but rather that the algorithms don't work correctly with layers with no fields. In which case it's likely also an issue in 2.x

It didn't work in 2.x:


cannot concatenate 'str' and 'NoneType' objects See log for more details

But it should work in ogr2ogr! Without the comma, I'm getting the correct result.

Could you perhaps add the comma only, if fields.length > 0 ?

@qgib
Copy link
Contributor Author

qgib commented Oct 16, 2017

Author Name: Nyall Dawson (@nyalldawson)


  • version was changed from master to 2.18.13

@qgib
Copy link
Contributor Author

qgib commented Oct 16, 2017

Author Name: Giovanni Manghi (@gioman)


isn't this duplicate of #24430 ?

@qgib
Copy link
Contributor Author

qgib commented Oct 16, 2017

Author Name: Tobias Wendorff (Tobias Wendorff)


Giovanni Manghi wrote:

isn't this duplicate of #24430 ?

No, I'm using the core function and my processing doesn't start at all, since the OGR commandline breaks.

@qgib
Copy link
Contributor Author

qgib commented Oct 16, 2017

Author Name: Giovanni Manghi (@gioman)


  • status_id was changed from Feedback to Open
  • assigned_to_id was changed from Victor Olaya to Giovanni Manghi

@qgib
Copy link
Contributor Author

qgib commented Oct 16, 2017

Author Name: Giovanni Manghi (@gioman)


  • subject was changed from QGIS3: OGR processing of scratch layers doesn't work to OGR processing of scratch layers doesn't work

@qgib
Copy link
Contributor Author

qgib commented Oct 17, 2017

Author Name: Giovanni Manghi (@gioman)


I have a fix in the works for master/qgis3 (for the buffer tool at least), for qgis2 I really think that the issue is the same of #24430 : in Processing scratch layers (with or without fields) are not supported.

@qgib
Copy link
Contributor Author

qgib commented Oct 24, 2017

Author Name: Giovanni Manghi (@gioman)


A better and more complete fix for master #5436

@qgib
Copy link
Contributor Author

qgib commented Oct 26, 2017

Author Name: Alexander Bruy (@alexbruy)


Applied in changeset 4a51c40.


  • done_ratio was changed from 0 to 100
  • status_id was changed from Open to Closed

@qgib qgib closed this as completed Oct 26, 2017
@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms Regression Something which used to work, but doesn't anymore labels May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms Regression Something which used to work, but doesn't anymore
Projects
None yet
Development

No branches or pull requests

1 participant