I created a spatiaLite Database with a point layer (every point is a tree). Additional I created several tables to fill the columns of the spatial layer with attributes using the editing widget “value relations”. I need this because I want to speed up data entry! For some other attribute fields the data entry occurs via “line edit”. I also designed a custom form like Nathan Woodrow describes it in his blog. This works pretty good. Now my problem is not the data entry but the data output. I want to print a custom data sheet with all my attributes that occurs to one point (tree) that I’ve selected before. Can I do this with the print composer (it should also contain a small map with the point an the google satellite layer)? When I tried to realize this I inserted an attribute table by choosing the relevant attributes. For those attributes where I’ve used the edit widget “value relation” the entry in my table is the entry of the key column in my external table. But I need the entries in the value column. Maybe there is a better way to get this work done? Thanks for any help, Patrick
Answer
I would create a view in spatialite which is composed of the geography from the "trees" table, and the (linked) attributes from the other tables. THen display that view in QGIS, and you'll get the values rather than the common keys. Suppose, for example, that you have a table of trees, with geometry, primary key, and an key column "attrib1_id" and another attributes table "attrib1" with a key column and a "label" column. Something like this would probably work:
CREATE VIEW tree_attribs AS
SELECT trees.ROWID AS ROWID,
trees.pk_uid,
trees.geometry AS geometry,
attrib1.label AS label
FROM trees JOIN attrib1 ON trees.attrib1_id = attrib1.attrib1_id;
No comments:
Post a Comment