mirror of
https://github.com/qgis/QGIS.git
synced 2025-11-13 00:07:27 -05:00
parent
644dfcf8ea
commit
98ff01ea1c
@ -308,6 +308,24 @@ class PGVectorTable(PGTable, VectorTable):
|
|||||||
return True
|
return True
|
||||||
return VectorTable.runAction(self, action)
|
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):
|
class PGRasterTable(PGTable, RasterTable):
|
||||||
|
|
||||||
|
|||||||
@ -159,7 +159,7 @@ class DBTree(QTreeView):
|
|||||||
def addLayer(self):
|
def addLayer(self):
|
||||||
table = self.currentTable()
|
table = self.currentTable()
|
||||||
if table is not None:
|
if table is not None:
|
||||||
layer = table.toMapLayer()
|
layer = table.toMapLayer(table.geometryType())
|
||||||
layers = QgsProject.instance().addMapLayers([layer])
|
layers = QgsProject.instance().addMapLayers([layer])
|
||||||
if len(layers) != 1:
|
if len(layers) != 1:
|
||||||
QgsMessageLog.logMessage(
|
QgsMessageLog.logMessage(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user