diff --git a/data_sources_panel/dockwidget.py b/data_sources_panel/dockwidget.py
index 9046196..95ba191 100644
--- a/data_sources_panel/dockwidget.py
+++ b/data_sources_panel/dockwidget.py
@@ -59,7 +59,7 @@ def __init__(self, data: LayerSources):
def data(self, index, role):
if role == Qt.DisplayRole:
src = self._data.by_index(index.row())
- item = src.by_index(index.column() + 1) # skip layerid field
+ item = src.by_index(index.column() + 2) # skip layerid and geom_type fields
if index.column() == 2:
return nice_provider_name(item)
return str(item)
@@ -71,7 +71,7 @@ def rowCount(self, index):
return self._data.num_layers()
def columnCount(self, index):
- return self._data.num_fields() - 2 # skip layerid, icon fields
+ return self._data.num_fields() - 3 # skip layerid, geom_type, icon fields
def headerData(self, index, orientation, role):
if orientation == QtCore.Qt.Horizontal and role == QtCore.Qt.DisplayRole:
diff --git a/data_sources_panel/i18n/data_sources_panel_de.ts b/data_sources_panel/i18n/data_sources_panel_de.ts
index d9c246f..584c92f 100644
--- a/data_sources_panel/i18n/data_sources_panel_de.ts
+++ b/data_sources_panel/i18n/data_sources_panel_de.ts
@@ -14,137 +14,137 @@
Layer
-
+
Datenanbieter
-
+
Speicherort
-
+
Datenquellen
-
+
&Tabellenansicht
-
+
&Baumansicht
-
+
Alle &ausklappen
-
+
Alle &einklappen
-
+
Export
-
+
Als &Excel-Datei exportieren
-
+
Als &CSV-Datei exportieren
-
+
CSV (Komma-getrennte Werte)
-
+
Excel-Arbeitsmappe (*.xlsx)
-
+
Datenquellen-Tabelle exportieren
-
+
Export abgebrochen
-
+
Datenquellen-Tabelle erfolgreich nach {output_file} exportiert
-
+
Export nach {output_file} fehlgeschlagen: {error} {message}
-
+
(unbekannt)
-
+
layerid
-
+
Name
-
+
WMS/WMTS
-
+
WFS
-
+
PostgreSQL
-
+
PostgreSQL-Raster
-
+
SpatiaLite
-
+
Temporärlayer
-
+
DB
-
+
Schema
@@ -154,20 +154,30 @@
&Datenquellen
-
+
Vektordateien (OGR)
-
+
Rasterdateien (GDAL)
-
+
KBS
+
+
+
+ kein KBS
+
+
+
+
+ Geometrie (WKB-Typ)
+
DataSourceDockWidget
diff --git a/data_sources_panel/layer_sources.py b/data_sources_panel/layer_sources.py
index f3eb365..a9db846 100644
--- a/data_sources_panel/layer_sources.py
+++ b/data_sources_panel/layer_sources.py
@@ -15,8 +15,10 @@
QgsMessageLog,
QgsProject,
QgsProviderRegistry,
+ QgsRasterLayer,
QgsVectorLayer,
- QgsVectorLayerUtils
+ QgsVectorLayerUtils,
+ QgsWkbTypes
)
from qgis.PyQt.QtCore import QVariant
from qgis.PyQt.QtGui import QIcon
@@ -51,12 +53,17 @@ def __str__(self):
@dataclass
class LayerSource:
layerid: str
+ geom_type: str
name: str
crs_authid: str
provider: str
location: StorageLocation
icon: QIcon
+ def __post_init__(self):
+ if not self.crs_authid and self.geom_type != 'NoGeometry':
+ self.crs_authid = tr('no CRS')
+
def num_fields(self):
return len(fields(self))
@@ -148,9 +155,15 @@ def get_source_from_layer(self, layer, layerid: str = None):
location = StorageLocation(None, tr('(unknown)'))
icon = QgsIconUtils.iconForLayer(
QgsProject.instance().mapLayer(layerid))
+ if isinstance(layer, QgsVectorLayer):
+ geom_type = QgsWkbTypes.displayString(layer.wkbType())
+ elif isinstance(layer, QgsRasterLayer):
+ geom_type = 'Raster'
+ else:
+ geom_type = ''
crs_authid = provider.crs().authid()
return LayerSource(
- layerid=layerid, name=layer.name(), crs_authid=crs_authid,
+ layerid=layerid, name=layer.name(), geom_type=geom_type, crs_authid=crs_authid,
provider=provider_name, location=location, icon=icon)
def num_layers(self) -> int:
@@ -194,6 +207,7 @@ def as_memory_layer(self, name: str = 'Data Sources'):
prov.addAttributes([
QgsField(tr('layerid'), QVariant.String),
QgsField(tr('Name'), QVariant.String),
+ QgsField(tr('Geometry (WKB type)'), QVariant.String),
QgsField(tr('CRS'), QVariant.String),
QgsField(tr('Provider'), QVariant.String),
QgsField(tr('Storage Location'), QVariant.String)
@@ -202,8 +216,8 @@ def as_memory_layer(self, name: str = 'Data Sources'):
features = [
QgsVectorLayerUtils.createFeature(
mem_layer, QgsGeometry(), {
- 0: src.layerid, 1: src.name, 2: src.crs_authid,
- 3: nice_provider_name(src.provider), 4: str(src.location)
+ 0: src.layerid, 1: src.name, 2: src.geom_type, 3: src.crs_authid,
+ 4: nice_provider_name(src.provider), 5: str(src.location)
})
for src in self.sources
]
diff --git a/data_sources_panel/metadata.txt b/data_sources_panel/metadata.txt
index 0407c02..7436ea3 100644
--- a/data_sources_panel/metadata.txt
+++ b/data_sources_panel/metadata.txt
@@ -24,7 +24,7 @@ repository=https://github.com/effjot/qgis-data-sources-panel
hasProcessingProvider=no
# Uncomment the following line and add your changelog:
changelog=
- 0.2.1 Show CRS info, updated documentation
+ 0.2.1 Show CRS info, export geometry type, updated documentation
0.2.0 German translation, other small improvements
0.1.0 Initial experimental release