Bug report #18010

Lyer doesn't work after reading .DBF file into Excel or Open office and writing it back out. No edits in Excel or Open Office required for this to happen.

Added by Brian Hanley about 6 years ago. Updated about 6 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Project Loading/Saving
Affected QGIS version:2.18.16 Regression?:No
Operating System:Windows 10 Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:25906

Description

Windows 10.
To duplicate, I am using the 1:20 million US Census county DBF file, cb_2016_us_county_20m.dbf. It is available here: https://www.census.gov/geo/maps-data/data/cbf/cbf_counties.html But, I have provided you with before and after files and screenshots so you don't have to go through duplicating to evaluate.

I read cb_2016_us_county_20m.dbf into either Excel 2003, or OpenOffice Calc. I make no changes. I write it out as a different name.
The names I used are: cb_2016_us_county_20ma.dbf for Calc, and cb_2016_us_county_20mb.dbf for Excel 2003. The same thing happens if I save the .DBF file out as a .xls file.
I can add a layer, but it seems to be classified as labels. Nothing can be displayed for it. See screenshots.
The layer displays with a different name: cb_2016_us_county_20m-b cb_2016_us_county_20m None. (So QGIS is finding the original file name somewhere in the .dbf or .xls file)

I wondered if the bug might be from the intra-file name not matching the name it is read from. So, I tried writing it out to a different directory with no name change and with the same name. Still doesn't work, so that's a red herring. But something in QGIS is adding "None" at the end if the file names mismatch, but it shows nothing like that if the new .DBF file name doesn't change. That's odd, but not a huge deal.

I compared the before and after files in Winmerge, and they have different carriage return formats. They also have slightly different data at the beginning of the file.
I am guessing this is a file parsing problem probably? Maybe it's also something in the layer import that is looking for a certain header pattern and not finding it?
Did my best with Category. Project Loading/Saving seemed to be the best fit for this. Sorry if it's wrong.

cb_2016_us_county_20m.dbf - Original us census file (513 KB) Brian Hanley, 2018-01-31 12:10 AM

cb_2016_us_county_20m-a.dbf - Read into OpenOffice Calc. No change. Write out. Fails. (513 KB) Brian Hanley, 2018-01-31 12:11 AM

cb_2016_us_county_20m-b.dbf - Read into Excel 2003. No change. Write out. Fails. (513 KB) Brian Hanley, 2018-01-31 12:13 AM

cb_2016_us_county_20m-b.xls - Read into Excel 2003. No change. Write out. Fails. (579 KB) Brian Hanley, 2018-01-31 12:14 AM

Bug1.png - UI screenshot w/ only bad layer (not) rendering. (134 KB) Brian Hanley, 2018-01-31 12:15 AM

Bug1-2.png - UI screenshot w/ original file rendering properly. (333 KB) Brian Hanley, 2018-01-31 12:18 AM

Bug1-3.png - UI screenshot w/ file written out as the same name in a different directory. (135 KB) Brian Hanley, 2018-01-31 12:28 AM

History

#1 Updated by Giovanni Manghi about 6 years ago

  • Priority changed from Normal to High

#2 Updated by Harrissou Santanna about 6 years ago

  • Status changed from Open to Feedback

I might be wrong but aren't you trying to open a dbf file and expecting it to be a geometry enabled layer? Dbf is only tabular data. It won't show geometry when opened in QGIS.
It requires the shp and shx files (a minima and with the same name) to display geometries. And it's the shp file that you need to open.

#3 Updated by Giovanni Manghi about 6 years ago

  • Crashes QGIS or corrupts data changed from Yes to No
  • Resolution set to invalid
  • Status changed from Feedback to Closed
  • Priority changed from High to Normal
  • Easy fix? changed from Yes to No

Harrissou Santanna wrote:

I might be wrong but aren't you trying to open a dbf file and expecting it to be a geometry enabled layer? Dbf is only tabular data. It won't show geometry when opened in QGIS.

it seems to be the case, please reopen if is not.

Also available in: Atom PDF