Opened 17 years ago
Closed 15 years ago
#554 closed enhancement (worksforme)
identify - some varchar column displayed instead of the key column
Reported by: | Owned by: | timlinux | |
---|---|---|---|
Priority: | minor: annoyance | Milestone: | Version 1.2.0 |
Component: | Vectors | Version: | Trunk |
Keywords: | Cc: | ||
Must Fix for Release: | Yes | Platform: | All |
Platform Version: | Awaiting user input: | no |
Description
When I'm querying a GRASS vector I get a strange result that a varchar column (which is not the key column) is mentioned twice - see the attached picture.
Please note that the key column is "cat", not the "name":
$ v.db.connect -p cieki12_2zl Vector map <cieki12_2zl> is connected by: layer <1> table <cieki12_2zl> in database </home/grassdata/caves_utm33/melio2/dbf/> through driver <dbf> with key <cat>
Maciek
Attachments (3)
Change History (14)
by , 17 years ago
Attachment: | doubled_columns.png added |
---|
comment:1 by , 17 years ago
by , 17 years ago
Attachment: | wrong_key.tar.bz2 added |
---|
comment:2 by , 17 years ago
Version: | 0.8.1 → 0.8 |
---|
comment:3 by , 17 years ago
Milestone: | Version 0.8.1 → Version 0.8.2 |
---|
Moved to milestone 0.8.2 since we wont be fixing any further issues before the 0.8.1 release
comment:4 by , 16 years ago
Awaiting user input: | unset |
---|
You can obtain the same behavior also with other OGR vector (es. shapes)
comment:5 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Hi
I believe this is in fact intended behaviour as the QgsVectorLayer author implemented it :
207 // If fldName is provided, use it as the display field, otherwise 208 // determine the field index for the feature column of the identify 209 // dialog. We look for fields containing "name" first and second for 210 // fields containing "id". If neither are found, the first field 211 // is used as the node.
Unless I am completely misunderstanding the issue...
One thing I did notice is that when I tried to change the display field to 'cat' using the test dataset provided above, the display field only showed 'name' as an option. Perhaps we need to allow display field to be set to non string fields. I will investigate futher.
In the meantime please clarify any misunderstanding I have - I would like to move this ticket from bug to enhancement and from status major to enhancement and remove must fix annotation. I await your feedback.
Regards
Tim
follow-up: 7 comment:6 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Hi
Ok another update on this. I found the problem causing display field combo box issues in vector props dialog (applied as r8977. For me the issue is resolved now following this procedure:
- load supplied 'wrong key' dataset
- open vector properties
- select general tab
- select 'cat' for display field
- close vector properties
- use identify tool to select a feature
Result is shown in the attached screenie (https://trac.osgeo.org/qgis/attachment/ticket/554/ticket_554.jpeg).
I'm marking this ticket as fixed now. Please reopen if it does not work for you.
Regards
Tim
follow-up: 11 comment:7 by , 16 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Version: | 0.8 → HEAD |
Replying to timlinux:
For me the issue is resolved now following this procedure:
- load supplied 'wrong key' dataset
- open vector properties
- select general tab
- select 'cat' for display field
- close vector properties
- use identify tool to select a feature
You did not understand the issue. It is that QGIS fails to recognise the *real* key column of the GRASS vector's dbf table. In case of the example vector map the key column is *cat*, not *name*. See the output of a command which confirms it:
$ v.db.connect -p wrong_key Vector map <wrong_key@wrong_key> is connected by: layer <1> table <wrong_key> in database </home/grassdata/wrong_key/wrong_key/dbf/> through driver <dbf> with key <cat>
In case of GRASS the id is "category" and nothing else ("category" is the official name in GRASS lingo). If the vector map has a table attached, the table contains a "key column" where "categories" are stored, and which lets link the vector features having "categories" with their attributes in the table. Usually the "key column" name is "cat", but it can be *anything*. v.db.connect -p can be used to detect the "key column" name.
Anyway, in case of GRASS vectors it would be best to just use the "category" number as the node and not bother with detecting the "key column" at all (mind that GRASS allows multiple features to have the same "category", which provides the same functionality as Shapefile's or PostGIS multi- feautures). If that's not possible now, please at least default to the *real* key column.
I don't know what would be the right approach for other formats, but it looks very strange when in case of a Shapefile which has e.g. 2 columns 'area' and 'length' one of them is used for the node. Wouldn't the "OGRFeature" be a better node candidate?
comment:8 by , 16 years ago
Platform: | Debian → All |
---|---|
Platform Version: | Ubuntu Dapper |
comment:9 by , 15 years ago
Component: | Vectors → GRASS |
---|---|
Milestone: | Version 1.0.3 → Version 1.2.0 |
comment:10 by , 15 years ago
Component: | GRASS → Vectors |
---|
comment:11 by , 15 years ago
Priority: | major: does not work as expected → minor: annoyance |
---|---|
Resolution: | → worksforme |
Status: | reopened → closed |
Type: | bug → enhancement |
Replying to msieczka:
Replying to timlinux:
For me the issue is resolved now following this procedure:
- load supplied 'wrong key' dataset
- open vector properties
- select general tab
- select 'cat' for display field
- close vector properties
- use identify tool to select a feature
You did not understand the issue. It is that QGIS fails to recognise the *real* key column of the GRASS vector's dbf table. In case of the example vector map the key column is *cat*, not *name*.
I don't see the problem here. In the identify dialog you don't see the key at the top, you see the display field.
And QGIS selects the first field which field name contains name
, descrip
or {{id}} (in that order). If there is none it takes the first field. See QgsVectorlayer::setDisplayField().
So there's no relation between the key and the display field.
This problem is not reproducible with all GRASS vectors - usually a correct key is reported.
To reproduce it use the attached GRASS vector "wrong_key" form location/mapset "wrong_key/wrong_key".
Maciek