Bug report #12713

when columns have the same name, styling with the first one does not work

Added by Paolo Cavallini over 9 years ago. Updated over 6 years ago.

Status:Open
Priority:Normal
Assignee:-
Category:Vectors
Affected QGIS version:3.0.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:20819

Description

new description:

#12713-3

old description:

This file:
http://www.faunalia.eu/~paolo/qgis/result.zip
resulting from
processing.runalg("saga:gridstatisticsforpolygons","/tmp/RESULT.tif","/path/municipalities.shp",False,False,True,False,True,False,False,False,0,None)
seems impossible to thematize on the basis of the ``Calculated`` column.
If saved as a new shapefile, it is OK. Possibly SAGA produces a wrong dbf?

History

#1 Updated by Even Rouault over 9 years ago

Examination with ogrinfo shows that there are in fact 2 columns with same name "Calculated" (and with different values), which must confuse QGIS.

#2 Updated by Paolo Cavallini over 9 years ago

  • Target version set to Future Release - High Priority
  • Category changed from Symbology to Processing/SAGA

Merci Even for checking. So this should be either an issue of Processing, not giving appropriate column names, or upstream (saga).

#3 Updated by Giovanni Manghi over 9 years ago

  • Affected QGIS version changed from 2.8.1 to master
  • Status changed from Open to Feedback
  • Category changed from Processing/SAGA to Vectors
  • Subject changed from Shp cannot be stylized to shapefile cannot be stylized when columns have the same name

There are two issues here, but the real one seems a qgis issue.

The SAGA module gridstatisticsforpolygons creates an output shapefile where the statistics are placed into columns that are called "nameoftheinputraster [nameofthestatistics]" and this is very likely to hit the 10 char limit for column names. So the result is likely to have different columns that have the exactly same name (the first 10 chars of input raster), and this is confirmed by ogrinfo of course.

When opening a shapefile with at least two columns with the exact same name, ex: "columnname", qgis "changes" the name of the 2nd, 3rd... to "columnname_1", "columnname_2", etc. Styling using the values for this "renamed" columns works, but not for the first one.

#4 Updated by Giovanni Manghi over 9 years ago

  • Status changed from Feedback to Open

#5 Updated by Giovanni Manghi over 9 years ago

  • Subject changed from shapefile cannot be stylized when columns have the same name to when columns have the same name, styling with the first one does not work

#6 Updated by Giovanni Manghi over 7 years ago

  • Regression? set to No
  • Easy fix? set to No

#7 Updated by Jürgen Fischer about 7 years ago

  • Description updated (diff)

#8 Updated by Paolo Cavallini over 6 years ago

  • Affected QGIS version changed from master to 3.0.0

Still true in QGIS 3.

Also available in: Atom PDF