Opened 17 years ago

Closed 15 years ago

#554 closed enhancement (worksforme)

identify - some varchar column displayed instead of the key column

Reported by: tutey@… 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)

doubled_columns.png (5.9 KB ) - added by tutey@… 17 years ago.
wrong_key.tar.bz2 (27.0 KB ) - added by tutey@… 17 years ago.
ticket_554.jpeg (8.3 KB ) - added by timlinux 16 years ago.
Screenshot showing issue resolved

Download all attachments as: .zip

Change History (14)

by tutey@…, 17 years ago

Attachment: doubled_columns.png added

comment:1 by tutey@…, 17 years ago

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

by tutey@…, 17 years ago

Attachment: wrong_key.tar.bz2 added

comment:2 by anonymous, 17 years ago

Version: 0.8.10.8

comment:3 by timlinux, 17 years ago

Milestone: Version 0.8.1Version 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 leolami, 16 years ago

Awaiting user input: unset

You can obtain the same behavior also with other OGR vector (es. shapes)

comment:5 by timlinux, 16 years ago

Owner: changed from nobody to timlinux
Status: newassigned

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

by timlinux, 16 years ago

Attachment: ticket_554.jpeg added

Screenshot showing issue resolved

comment:6 by timlinux, 16 years ago

Resolution: fixed
Status: assignedclosed

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

in reply to:  6 ; comment:7 by msieczka, 16 years ago

Resolution: fixed
Status: closedreopened
Version: 0.8HEAD

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 msieczka, 16 years ago

Platform: DebianAll
Platform Version: Ubuntu Dapper

comment:9 by pcav, 15 years ago

Component: VectorsGRASS
Milestone: Version 1.0.3Version 1.2.0

comment:10 by pcav, 15 years ago

Component: GRASSVectors

in reply to:  7 comment:11 by jef, 15 years ago

Priority: major: does not work as expectedminor: annoyance
Resolution: worksforme
Status: reopenedclosed
Type: bugenhancement

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.

Note: See TracTickets for help on using tickets.