[Qgis-developer] Domains
Marco Hugentobler
marco at hugis.net
Sun Sep 20 07:14:29 EDT 2009
Hi Mauricio
I hope to understand your question correctly. You are reffering to the use of
domain type constraints to handle enumeration types, right?
QGIS supports constrains on domain types in postgres. The constraint needs to
be defined in the form 'VALUE in ('a', 'b', 'c', 'd')'. If so, the postgres
provider detects it and offers those values as possible enum types for a field.
If you then choose 'enumeration' as edit types, QGIS offers those in the
attribute dialog when editing. This is a good way to work with enumeration
types in postgres because the standart postgres enum type cannot be changed
once in use (but nevertheless, QGIS supports also the normal enum type of
postgres).
Such an approach could also be implemented for other data providers (e.g.
spatialite). Just implement the method QgsVectorDataProvider::enumValues
accordingly.
Regards,
Marco
Am Freitag, 18. September 2009 13.43:24 schrieb Maurício de Paulo:
> Hi list,
> I was asked about QGIS and field domains and I began to search for some
> answers. As far as I could see, QGIS have domain support and one can set
> these domains. Is there a way to set QGIS to search the domains from a
> table or file? (like doing a join in a domain table).
> The purpose of this is that ESRI PGeo comes with the gdb_codeddomains
> inside it's own dataset, and one could read these data and set as
> comboboxes in qgis. When talking about SpatiaLite, Postgis and Shapefiles,
> we could use domain tables to allow the user to set the attributes from
> these lists rather than setting numbers like 0, 1, 2.
> I was thinking about writing a plugin to read the parameters from a
> nonspatial table and set the domains using QgsVectorLayer::setEditType *
> ValueMap*, but I think it's an odd approach for this problem.
> Does anyone have experience with this and can shead a light on how it would
> be easier to the user to see these domains? The main difference from PGeo
> is that we don't have a fixed domain table so I think it should be flexible
> enough to read the domains from tables from any dataset qgis suport.
> Maurício de Paulo.
--
Dr. Marco Hugentobler
HUGIS - GIS programming and consulting
Honrainweg 5
CH-8038 Zürich
marco at hugis.net
http://homepage.hispeed.ch/hugis/
More information about the Qgis-developer
mailing list