Bug report #8241

Make ftools work also when inputs have columns wider than 10 characters

Added by Aren Cambre over 10 years ago. Updated almost 7 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Processing/QGIS
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:17052

Description

New description:

a few tools in the vector menu are unable to cope with attributes with names of > 10 chars. The tools are

doGeoprocessing.py

intersect
union
symetrical_difference

doSpatialJoin.py

spatialjoin

Please see #8241-3 for a detailed description


Old description:

I have a PostGIS table with a field name that has more than 10 characters in the name. The Symmetrical difference feature fails with a message that simply advises of this problem but gives no solutions.

I really, really need to keep descriptive field names in the original data, so renaming fields is very undesirable.

I can think of a few workarounds, but seems like it would be easy to just use a truncated field name, with a check to ensure the truncated field name dos not duplicate any other field names.

Associated revisions

Revision 8ae64b43
Added by Minoru Akagi over 10 years ago

fTools: remove unnecessary checks on output field names (fix #8241)

History

#1 Updated by Aren Cambre over 10 years ago

Related: #3857

#2 Updated by Giovanni Manghi over 10 years ago

  • Tracker changed from Bug report to Feature request
  • Subject changed from Symmetrical difference fails if field name is more than 10 characters to Make "symmetrical difference" work also when inputs have columns wider than 10 characters
  • Operating System deleted (Windows 7 x64)
  • Category changed from Vectors to 44
  • Target version changed from Version 2.0.0 to Future Release - Nice to have

The error message could be a little more verbose, but it is right anyway: the output of the geoprocessing tools are shapefiles, regardless of the input data type, and shapefiles are limited to 10 chars for columns names.

Sure there can be workarounds (like truncating the columns names, like the "join" does) or real solutions (like make the geoprocessing tools create an output in the same data type as the inputs, or of a kind at user choice), but are all feature requests.

#3 Updated by Minoru Akagi over 10 years ago

Some fTools' processes are sometimes discontinued for the same reason. Especially with "Join attributes by location" tool, when we select the MEAN option, the length of the field names must be only six or less. Processes are often stopped unnecessarily and users are forced to change the field names, so I think this is a bug. Since no error occurs even when long field names are passed to QgsVectorFileWriter and the writer truncates the field names to the appropriate length, the fix should be very easy. Showing message like "Following field names will be truncated to 10 bytes" would be helpful for users, but we are currently in string freeze, and it is not necessary.

#4 Updated by Giovanni Manghi over 10 years ago

Minoru Akagi wrote:

Some fTools' processes are sometimes discontinued for the same reason. Especially with "Join attributes by location" tool, when we select the MEAN option, the length of the field names must be only six or less. Processes are often stopped "unnecessarily" and users are forced to change the field names, so I think this is a bug. Since no error occurs even when long field names are passed to QgsVectorFileWriter and the writer truncates the field names to the appropriate length, the fix should be very easy. Showing message like "Following field names will be truncated to 10 bytes" would be helpful for users, but we are currently in string freeze, and it is not necessary.

If this issue is widespread in the vector menu tools then I agree that this should be a bug. Then title and description of this ticket must be rephrased (eventually listing all the tools that do not work because of this issue), please go ahead.

#5 Updated by Minoru Akagi over 10 years ago

I cannot retitle this ticket, so I list 4 tools using ftools_utils.checkFieldNameLength() instead.

doGeoprocessing.py
  • intersect
  • union
  • symetrical_difference
doSpatialJoin.py
  • spatialjoin

#6 Updated by Giovanni Manghi over 10 years ago

  • Tracker changed from Feature request to Bug report
  • Subject changed from Make "symmetrical difference" work also when inputs have columns wider than 10 characters to Make ftools work also when inputs have columns wider than 10 characters

#7 Updated by Minoru Akagi over 10 years ago

  • Status changed from Open to Closed

#8 Updated by Giovanni Manghi almost 7 years ago

The "ftools" category is being removed from the tracker, changing the category of this ticket to "Processing/QGIS" to not leave the category orphaned.

#9 Updated by Jürgen Fischer almost 7 years ago

  • Regression? set to No
  • Description updated (diff)
  • Easy fix? set to No

Also available in: Atom PDF