[Qgis-developer] geometryless tables

Carson Farmer carson.farmer at gmail.com
Sun Mar 13 09:00:33 EDT 2011


Hi Devs,

Does anyone know if it's possible to (programatically) load a layer as
a geometyless table? In other words, say I have a shapefile named
foo.shp, is it possible to load foo.dbf without the spatial
information? I know I can open PostGIS tables, and even csv files this
way... but if I try this with a dbf file that has an associated .shp
file, it automatically loads the shp files as well.I see from the
QgsOgrProvider source that there is a setRelevantFields() function
which looks to do what I want (uses OGR's SetIgnoreFields, where we
can use the special "OGR_GEOMETRY" specifier), but it is protected,
and my initial attempts to alter things to get access to it do not
seem to have worked... Any suggestions? Ultimately, what I'd like to
be able to do is white a simple plugin to load geometryless tables for
joining etc in QGIS. I'm about 90% of the way done (it already works
for csv files, and lone dbf files), but I'd like something a bit more
generic so it could work with pretty much any ogr supported format.
Has anyone else already done such a thing?

Cheers,

Carson

-- 
Carson J. Q. Farmer
ISSP Doctoral Fellow
National Centre for Geocomputation
National University of Ireland, Maynooth,
http://www.carsonfarmer.com/


More information about the Qgis-developer mailing list