I am using ArcGIS Desktop 10.3.

A third party convert complex autocad drawing (dwg) to shapefile for us. I got from them a zip folder with 1 to 16 Shapefile (depending of the original dwg data), all shapefile come with 4 file (.dbf, .prj, .shp and .shx) and I can visualize the data without problem, the attribute table seem fine when I open it.

The problem arise when I try to update a field using either the field calculator or manually. The below picture illustrate the problem, first is the original table, second is after using the field calculator and third the calculator.

enter image description here

enter image description here

enter image description here

(for test purpose the calculate was only writing "A" in the ALT column (column in text format, length 255))

As you can see not only spaces are inserted before the A (as if I have " A" as input) but the POINT_X field got truncated and the POINT_Y and POINT_Z column are filled with what seem to be random value. The same thing happen if a manually edit a value, as soon as I save edits all value are modified.

the insertion of space before text column follow a pattern : no space added on first column, one space added on second column, two space on third and so on...

This kind of behavior happens on all field (text field get added space and numeric field are modified) on all shape from this provider. The only workaround is to export the shapefile (exported shapefile come with .cpg, .dbf, .prj, .sbn, .sbx, .shp and .shx and behave as expected).

I will ,of course, ask the provider of the shapefile to look into the problem and try to fix it, but I'm curious what it could cause this behavior and how to fix it on my side.

adding a .cpg file from a working shapefile doesn't change anything but exporting either to .shp or to gdb fix the problem.

This problem seem to be a specific Arcgis problem as the problem didn't occur on QGIS (can edit without problem) and opening a messed-up shp in QGIS show the text column without the extra space before the text but the numeric column are still wrong. After editing and saving the edit in QGIS the shp appear fine in Arcgis and can now be normally edited.

  • 4
    Try shapefile to file geodatabase, then repeat the actions above, do you get the same issues? – Mapperz Oct 26 '18 at 16:29
  • 2
    I agree with the suggestion above. Adding the shapefiles by exporting to the file geodatabase should resolve the issue. – Gurminder Bharani Oct 26 '18 at 17:00
  • 3
    If you copy a .cpg file from a working shapefile to a non-working one, does it now work? I am wondering if the software is having trouble with the comma-as-decimal-place without the codepage file. – mkennedy Oct 26 '18 at 17:08
  • 2
    What's the field length of Alt? – smiller Oct 26 '18 at 17:23
  • 2
    I have found a bug which somewhat states the same issue about rounding the data: support.esri.com/en/bugs/nimbus/QlVHLTAwMDA5OTcxOA== – Gurminder Bharani Oct 26 '18 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.