I need to find the correct path to use tables and views from a PostGIS database in QGIS. The database was populated importing shapefiles with QGIS DBmanager, and then other tables and views where produced with SQL sentences. When I use algorithms involving interpolation or kriging from GRASS or SAGA, no one works. I'm using a projected file, and when apply the QGIS native algorithms works fine (idw). The error shows some problem with the temporary .shp file created. So, my best guess is that the problem is with the usage of a database file. I have already try using directly the file from the database, or exporting it with pgsql2shp, with PostGIS shapefile import/export manager, or with QGIS complement DBmanager. Same result.

I'm using QGIS 2.14 and 3.8, the same problem in both. Windows 10, PostgreSQL 10, PostGIS bundle 2.4.4.

  • 1
    You've introduced confusion here by referring to "files stored in a ... database". Databases use tables. Did you convert the records in the files to rows in a database table? Did you store binary large objects (BLOBs) of the files in the database tables? The difference between these approaches changes the answer. Please edit the question to contain more details on how you have stored the data, and how you are attempting to reference it. – Vince Jun 26 at 20:26
  • @Vince i hope the editing help to understand the issue. thanks – javier Jun 27 at 16:34

Found the problem. Neither GRASS or SAGA works with geometries of the type Multi...(point, polygon, etc). The POSTGIS database could take them that way, so, before export any file from POSTGIS you need to ST_Geometry(geom,1) for example:

ALTER TABLE <table_name> ALTER COLUMN geom TYPE geometry(Polygon,4326) USING ST_Geometry(geom, 1);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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