Friday, 25 March 2016

Performing Geoprocessing SQL Queries in QGIS from a PostGIS Database


This may be a dumb question, but is there way to run a PostGIS geoprocessing SQL query in QGIS? Specifically, I am thinking of running SQLs such as ST_Union, ST_Split etc etc.


I have tried the following SQL in the QGIS PostGIS Query Editor without any luck, while the query worked in PostGIS.


SELECT covtype, ST_Multi(ST_Union(f.the_geom)) as sGeom
INTO testLCC
FROM lcc2000_001k AS f
GROUP BY covtype;


SELECT populate_geometry_columns
('testLCC'::regclass);

ALTER TABLE testLCC ADD CONSTRAINT pkid PRIMARY KEY(covtype);

Answer



You want PgQuery for QGIS


enter image description here


Can be downloaded via Fetch Python Plugins in QGIS and filter for pgquery


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...