[Qgis-user] Importing to postgres db fails on 2.14

Nikolai Bezdna mofoyoda at gmail.com
Fri Mar 11 07:01:02 PST 2016


Hi Jorge,

I’ve tested this issue further and figured out that the thing that prevents geometry column from being created before this sql checks is geometry type of an imported layer. The layer, that I’m trying to import comes from another postgres db and is LineStringM (I really do use measures, so can’t just force it to 2D).
When trying to save this layer in QGIS in some other format (i.e. shapefile or geojson), I get an OGR error: 
"Feature geometry not imported (OGR error: Unsupported WKB type 2002)” 
for every feature in a layer. 
Trying to copy with ogr2ogr gives this: 
"ERROR 1: Reading EWKB with 4-dimensional coordinates (XYZM) is not supported”
But I don’t have a Z ordinate, just X,Y and M. 

For now I can try a workaround like dumping vertexes in 2D with M as an attribute, then importing it to a new base and then reconstructing the lines back, but that’s very inconvenient. Another option is to use postgres FDW to connect to another db and import tables directly, but that’s also not so great. I guess common drag’n’drop in qgis browser should work for XYM geometries aswell.

Can anyone confirm this issue with LineStringM layer?
Why isn’t XYM supported in OGR and doesn’t get created in QGIS? 

Cheers, Nick

> On 10 Mar 2016, at 23:53, Jorge Gustavo Rocha <jgr at di.uminho.pt> wrote:
> 
> Hi Nikolai,
> 
> I was not able to reproduce the problem. I've imported several layers, with different options, changing the geometry column, etc, and everything went smooth, as expected.
> 
> I'm using QGIS 2.14.0, PostgreSQL 9.5.1, Postgis 2.2.1, DB Manager 0.1.20.
> 
> The DB Manager reposts the following privileges (selecting the target DB):
> 
> User has privileges:
> create new schemas
> create temporary tables
> 
> Can you try on the command line, for example, using ogr2ogr with the same database, user and layer? Something like:
> 
> ogr2ogr -f "PostgreSQL" PG:"host=localhost user=xxx dbname=xxx password=xxx active_schema=xxx" -nln tablename data.shp
> 
> Regards,
> 
> J. Gustavo
> 
> 
> Às 20:39 de 10-03-2016, Nikolai Bezdna escreveu:
>> When importing a layer to a postgres db from a database manager window I
>> get an 'Error 8 Loading of layer failed' message.
>> From a postgis log the query part that fails is this one:
>> SELECT has_column_privilege('"myschema"."mytable"','mygeom','UPDATE')
>> And the error from postgres is well expected, because there is no
>> 'mygeom' column of relation 'mytable' yet.
>> Double checked that in pgAdmin.
>> Maybe geometry field should be created earlier?
>> 
>> Can anyone confirm if it's a bug? I'm on 2.14.0.
>> 
>> 
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
>> 
> 
> J. Gustavo
> -- 
> Jorge Gustavo Rocha
> Departamento de Informática
> Universidade do Minho
> 4710-057 Braga
> Tel: +351 253604480
> Fax: +351 253604471
> Móvel: +351 910333888
> skype: nabocudnosor




More information about the Qgis-user mailing list