NaturalGIS / naturalgis_postgis_geoprocessing

A plugin for the QGIS Processing toolbox to allow users do geoprocessing operations with PostGIS input layers
Other
17 stars 8 forks source link

Issue Running Fixed or Variable Buffer #26

Open RossBardwell opened 3 years ago

RossBardwell commented 3 years ago

The code appears to have an unexpected comma when running the variable or fixed distance buffer on QGIS 3.16.7:

QGIS version: 3.16.7-Hannover QGIS code revision: 0471743889 Qt version: 5.11.2 GDAL version: 3.1.4 GEOS version: 3.8.1-CAPI-1.13.3 PROJ version: Rel. 6.3.2, May 1st, 2020 Processing algorithm… Algorithm 'Buffer (variable distance)' starting… Input parameters: { 'DISSFIELD' : 'X', 'DISSOLVEALL' : True, 'DISTANCE' : 'ALT', 'FIELDS' : ['ALT','X','Y'], 'INPUT_LAYER' : 'C:/cov/Block1Coverage.shp', 'OPTIONS' : '', 'SCHEMA' : 'public', 'SINGLE' : False, 'TABLE' : 'buffer' }

GDAL command: ogr2ogr -f PostgreSQL C:/cov/Block1Coverage.shp C:/cov/Block1Coverage.shp -sql "SELECT (ST_Multi(ST_Union(ST_Buffer(,ALT))))::geometry(MULTIPOLYGON,2100) AS geom FROM Block1Coverage" -nln public.buffer -nlt MULTIPOLYGON -lco FID=gid -lco GEOMETRY_NAME=geom --config PG_USE_COPY YES -overwrite GDAL command output: ERROR 1: SQL Expression Parsing Error: syntax error, unexpected ','. Occurred around :

SELECT (ST_Multi(ST_Union(ST_Buffer(,ALT))))::geometry(MULTIPOLYGON,2100) AS

^

Execution completed in 0.13 seconds Results: {}

Loading resulting layers Algorithm 'Buffer (variable distance)' finished

Do you have any advice to fix this? I can share the test files privately if required.

Many thanks, Ross

gioman commented 3 years ago

@RossBardwell

the plugin is made to just process PostGIS inputs and return PostGIS outputs.

You can use the standard QGIS buffer tool using SHP as inputs and gave the tool write the output to a PostGIS database. The difference with the plugin is that with the plugin is the server that does the math, while with native QGIS tools is QGIS Desktop that does the math,

GDAL command: ogr2ogr -f PostgreSQL C:/cov/Block1Coverage.shp C:/cov/Block1Coverage.shp -sql "SELECT (ST_Multi(ST_Union(ST_Buffer(,ALT))))::geometry(MULTIPOLYGON,2100) AS geom FROM Block1Coverage" -nln public.buffer -nlt MULTIPOLYGON -lco FID=gid -lco GEOMETRY_NAME=geom --config PG_USE_COPY YES -overwrite GDAL command output: ERROR 1: SQL Expression Parsing Error: syntax error, unexpected ','. Occurred around :

SELECT (ST_Multi(ST_Union(ST_Buffer(,ALT))))::geometry(MULTIPOLYGON,2100) AS

^