lutraconsulting / qgis-geocat-plugin

Plugin for loading PostGIS layers based on a metadata search
GNU General Public License v2.0
5 stars 1 forks source link

PostGIS connection with service #38

Open tschuettenberg opened 4 years ago

tschuettenberg commented 4 years ago

First, this plugin is the perfekt completion to QGIS when deployed across a whole organisation with centralised data! Thanks for that!

But it seems that PostGIS connections, that are configured as service (pg_service.conf) and therefore every other field of the connection parameters remains empty, are not respected by the Plugin. I also use this in combination with the authentication. If choosing such a (otherwise working) connection I get the following python error:

Traceback (most recent call last):
  File "C:\Users\b4406621\AppData\Roaming\QGIS\geoservice\qgis-ltr\profiles\default/python/plugins\LayerMetadataSearch\geo_cat_config_dialog.py", line 159, in on_connection_changed
    cur = self._get_cur()
  File "C:\Users\b4406621\AppData\Roaming\QGIS\geoservice\qgis-ltr\profiles\default/python/plugins\LayerMetadataSearch\geo_cat_config_dialog.py", line 173, in _get_cur
    ci = get_postgres_conn_info(self.postGisConnectionComboBox.currentText())
  File "C:\Users\b4406621\AppData\Roaming\QGIS\geoservice\qgis-ltr\profiles\default/python/plugins\LayerMetadataSearch\dbutils.py", line 67, in get_postgres_conn_info
    conn_info["port"] = settings.value("port", 5432, type=int)
TypeError: unable to convert a QVariant of type 10 to a QMetaType of type 2

When retrying I only get "Can not connect to database. Please check connection." Because of the unavoidable(?) default port 5432 in the connection parameters dialog the plugin seems to recognise (only) an incomplete connection in this case?

How is it possible to use a postgres service connection within the Layer Metadata Serach Configuartion?