[Qgis-developer] implementing a custom QGIS data provider
Jürgen E. Fischer
jef at norbit.de
Sat Jun 19 14:38:20 EDT 2010
Hi Dave,
On Sat, 19. Jun 2010 at 10:56:05 -0400, Dave.DeHaan at sybase.com wrote:
> Option 1: Write an SA12 data provider plugin for QGIS in C++
I would recommend that approach. That's also what we use for PostGIS and
SpatiaLite.
> Pros: efficiency
> Cons/Questions: I'm not clear if or how C++ data providers can be
> dynamically added to an existing QGIS installation.
> a. Is there a way to add new C++ plugins without recompiling the source?
Yes. You can simply add them to the plugin directory and qgis will pick them
up. The libraries and headers you need to link against are include in the
installation.
But the C++ ABI is fragile and might break from QGIS build to build, even when
the API doesn't. So the provider might need rebuilds for each QGIS build.
Contributing the provider instead of distributing it yourself might be another
option.
> Option 2: Write an SA12 data provider plugin for QGIS in Python
> Pros: distribution/management is taken care of by the Python plugin
> manager
> Cons/Questions:
> a. Is this even possible? Looking through the repositories, I can't
> find an example of a data provider written in python, or at least not one
> that that allows definition of a DBMS-backed layer with full read/write
> access.
The bindings to QgsVectorDataProvider are there. So it should be possible, but
I never tried.
> Option 3: Write an extension to the GDAL/OGR library for SA12, to be
> accessed via "Add Vector Layer" -> Source Type = Database -> Type = SA12
> Pros: usability beyond QGIS to any OGR application
> Cons/Questions:
> a. if you currently try this and choose Type=Postgres, the new layer
> has less capabilities than a native PostGIS layer (it disallows feature
> deletion, along with certain other operations). Is this a limitation of
> the OGR interface, or is it a limitation of the OGR-PostgreSQL module?
The OGR provider queries OGR about the capabilities of the data source.
Looks like OGR's pg provider doesn't fully respond to that. Eg.
OGR_L_DeleteFeature should work for PG datasources, although
OGR_L_TestCapability on "DeleteFeature" returns false.
So yes, it's a limitation of the OGR PG driver and not QGIS OGR provider.
> b. currently there are OGR modules available for Informix Datablade,
> Oracle Spatial, ESRI GeoDatabase, etc.; however, a default QGIS
> installation (v1.5) only lists the following Types: ODBC, ESRI, OGDI,
> PostgreSQL, MySQL. Assuming an OGR module was written for SA12, how would
> one get it added to the drop-down list within the QGIS "Add Vector Layer"
> dialogue?
OGR doesn't have metadata on how datasource names are constructed. So the QGIS
UIs were handcrafted. So they are probably incomplete.
And the UIs are not part of the providers. So you'd need to provide a separate
plugin to provide a UI to add SA12 layers or contribute patches for the OGR
dialog.
Jürgen
--
Jürgen E. Fischer norBIT GmbH Tel. +49-4931-918175-20
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