Skip to content
Permalink
Browse files
[DB Manager] Fix recognition of project layers with Z/M…
…or CurvePolygon/MultyCurve/... geometry types as spatial layers.
  • Loading branch information
agiudiceandrea authored and nyalldawson committed Apr 29, 2021
1 parent 94bda8a commit 8a0f956f6028a15f44a4f38fe4804a400de38371
Showing with 14 additions and 39 deletions.
  1. +14 −39 python/plugins/db_manager/db_plugins/vlayers/connector.py
@@ -215,45 +215,20 @@ def getVectorTables(self, schema=None):

geomType = None
dim = None
g = l.dataProvider().wkbType()
if g == QgsWkbTypes.Point:
geomType = 'POINT'
dim = 'XY'
elif g == QgsWkbTypes.LineString:
geomType = 'LINESTRING'
dim = 'XY'
elif g == QgsWkbTypes.Polygon:
geomType = 'POLYGON'
dim = 'XY'
elif g == QgsWkbTypes.MultiPoint:
geomType = 'MULTIPOINT'
dim = 'XY'
elif g == QgsWkbTypes.MultiLineString:
geomType = 'MULTILINESTRING'
dim = 'XY'
elif g == QgsWkbTypes.MultiPolygon:
geomType = 'MULTIPOLYGON'
dim = 'XY'
elif g == QgsWkbTypes.Point25D:
geomType = 'POINT'
dim = 'XYZ'
elif g == QgsWkbTypes.LineString25D:
geomType = 'LINESTRING'
dim = 'XYZ'
elif g == QgsWkbTypes.Polygon25D:
geomType = 'POLYGON'
dim = 'XYZ'
elif g == QgsWkbTypes.MultiPoint25D:
geomType = 'MULTIPOINT'
dim = 'XYZ'
elif g == QgsWkbTypes.MultiLineString25D:
geomType = 'MULTILINESTRING'
dim = 'XYZ'
elif g == QgsWkbTypes.MultiPolygon25D:
geomType = 'MULTIPOLYGON'
dim = 'XYZ'
lst.append(
(Table.VectorType, lname, False, False, l.id(), 'geometry', geomType, dim, l.crs().postgisSrid()))
if l.isSpatial():
g = l.dataProvider().wkbType()
g_flat = QgsWkbTypes.flatType(g)
geomType = QgsWkbTypes.displayString(g_flat).upper()
if geomType:
dim = 'XY'
if QgsWkbTypes.hasZ(g):
dim += 'Z'
if QgsWkbTypes.hasM(g):
dim += 'M'
lst.append(
(Table.VectorType, lname, False, False, l.id(), 'geometry', geomType, dim, l.crs().postgisSrid()))
else:
lst.append((Table.TableType, lname, False, False))
return lst

def getRasterTables(self, schema=None):

0 comments on commit 8a0f956

Please sign in to comment.