[Qgis-developer] RFC vector data providers handling

Jürgen E. Fischer jef at norbit.de
Sun Apr 20 18:07:42 EDT 2008

Hi there,

I've looked at Godofredo's ogr-plugin-branch and ported it to trunk (see the
patch [1]) with some modifications.  I skipped the QgsConnectionRegistry and
QgsConnectionParameters and also removed QgsDataSourceURI at all.  As I think
both spread information where it doesn't belong.

I think we should do that a bit different. First of all the notation of a
datasources should be private to the provider.  So I think it's not good to mix
connection parameters of different providers.

It's probably best to keep that information in a QDomNode instead of a string
That could also be used in the project file: datasource and provider there
should be replaced with something like dataprovider that aggregates provider
name and the private datasource.

In the process QgsDbSourceSelect should be renamed to QgsSourceSelect.
The gui should list should list the registered vector data providers (classes).

Each data provider should have a private list of connections (ie. database
connection in PostgreSQL, datasources in OGR) and offer class methods to

- list connections by name,
- remove a connection by name,
- add and edit new connections (this would include a provider specific gui),
- return a list of datasource with the available vector layers through a named
  connection (ie. layers in OGR, geometry columns in PostgreSQL).  To support
  provider specific grouping (eg. for schemas in the PostgreSQL provider) that
  could be aggregated in a QDomNode.

The OGR provider gui should also include filebased sources, so that "add vector
layers" can be completely replaced with QgsSourceSelect (btw I believe there's
also an enhancement request in trac for something like that).

QgsSourceSelect would query a selected provider for a list of connections,
offer to add, edit and remove connections and list vector layers available
through the selected connection.  The available layers can then selected to be
added to the map.

This way we'd move provider specific code and information to the provider and
keep app/ clean.

Any comments or objections?


[1] http://buten.norbit.de/~jef/ogrmymerge.diff

Jürgen E. Fischer         norBIT GmbH               Tel. +49-4931-918175-0
Dipl.-Inf. (FH)           Rheinstraße 13            Fax. +49-4931-918175-50
Software Engineer         D-26506 Norden               http://www.norbit.de

norBIT Gesellschaft fuer Unternehmensberatung und Informationssysteme mbH
Rheinstrasse 13, 26506 Norden
GF: Jelto Buurman, HR: Amtsgericht Emden, HRB 5502

More information about the Qgis-developer mailing list