Feature request #3201

Attribute table editor shouldn't allow columns named 'shape'

Added by pinghanling - almost 9 years ago. Updated over 7 years ago.

Status:Closed
Priority:Low
Assignee:-
Category:GUI
Pull Request or Patch supplied:No Resolution:
Easy fix?:No Copied to github as #:13261

Description

QGIS allowed me to create an attribute column in a shapefile called 'Shape', which mysteriously disappeared.

When opening the file in ArcGIS, I saw that such a column exists in all shapefiles to display the type of entity - point, line or polygon.

I think it would be better if the GUI disallowed attributes with the name 'shape' and displayed a window to explain why.

Associated revisions

Revision 4629900e
Added by Alexander Bruy over 7 years ago

show warning when user tried to create field 'shape' in shapefile (fix #3201)

Revision d8f5b8d0
Added by Alexander Bruy over 7 years ago

show warning when user tried to create field 'shape' in shapefile (fix #3201)

History

#1 Updated by Giovanni Manghi almost 8 years ago

  • Target version changed from Version 1.7.0 to Version 1.7.4

#2 Updated by Alexander Bruy over 7 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

#3 Updated by Alister Hood over 7 years ago

  • Assignee deleted (nobody -)
  • Pull Request or Patch supplied set to No

I don't think this is the correct fix. I can create a Memory layer with a field called "shape", then "Save as" to a shape file. When I load the file it still has the field named "shape". The file can also be opened by other software successfully (and the field is visible).

Shall I create a new ticket? I can't reopen this one...

#4 Updated by Alister Hood over 7 years ago

Interesting - it used to be possible to add more than one field with the same name (not "shape"), but it isn't anymore ("The attribute could not be added to the layer").

#5 Updated by Jürgen Fischer over 7 years ago

Alister Hood wrote:

I don't think this is the correct fix. I can create a Memory layer with a field called "shape", then "Save as" to a shape file. When I load the file it still has the field named "shape". The file can also be opened by other software successfully (and the field is visible).

Apparently you can also open the shape in ArcGIS. It probably just hides the shape attribute as it uses that name to represent the features' virtual geometry "attribute". AFAICS not even the ESRI shapefile spec forbids the use of that attribute name. So I guess that warning is probably enough - and just what the submitter suggested.

#6 Updated by Jürgen Fischer over 7 years ago

Alister Hood wrote:

Interesting - it used to be possible to add more than one field with the same name (not "shape"), but it isn't anymore ("The attribute could not be added to the layer").

Since f6e507c36a9d1b8644b6edb91f680138560a4640 you shouldn't be able to add a column name that already, when create a new shapefile.

Also available in: Atom PDF