mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -04:00
parent
644dfcf8ea
commit
98ff01ea1c
@ -308,6 +308,24 @@ class PGVectorTable(PGTable, VectorTable):
|
||||
return True
|
||||
return VectorTable.runAction(self, action)
|
||||
|
||||
def geometryType(self):
|
||||
""" Returns the proper WKT type.
|
||||
PostGIS records type like this:
|
||||
| WKT Type | geomType | geomDim |
|
||||
|--------------|-------------|---------|
|
||||
| LineString | LineString | 2 |
|
||||
| LineStringZ | LineString | 3 |
|
||||
| LineStringM | LineStringM | 3 |
|
||||
| LineStringZM | LineString | 4 |
|
||||
"""
|
||||
geometryType = self.geomType
|
||||
if self.geomDim == 3 and self.geomType[-1] != "M":
|
||||
geometryType += "Z"
|
||||
elif self.geomDim == 4:
|
||||
geometryType += "ZM"
|
||||
|
||||
return geometryType
|
||||
|
||||
|
||||
class PGRasterTable(PGTable, RasterTable):
|
||||
|
||||
|
@ -159,7 +159,7 @@ class DBTree(QTreeView):
|
||||
def addLayer(self):
|
||||
table = self.currentTable()
|
||||
if table is not None:
|
||||
layer = table.toMapLayer()
|
||||
layer = table.toMapLayer(table.geometryType())
|
||||
layers = QgsProject.instance().addMapLayers([layer])
|
||||
if len(layers) != 1:
|
||||
QgsMessageLog.logMessage(
|
||||
|
Loading…
x
Reference in New Issue
Block a user