Bug report #15560

Missing Geometry in last row of some shapefile

Added by - - over 7 years ago. Updated over 6 years ago.

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

Description

QGIS considers a null geometry for the last row of some shapefiles (generated by a 3rd party software, see sample in attachment), but is visible in the attribute table.

Other programs (ArcGIS, Openwind) read the shapefile correclty, so it can be assumed that it a QGIS issue.

test_layout.zip (1.17 KB) - -, 2016-09-13 03:09 AM

History

#1 Updated by Jukka Rahkonen over 7 years ago

The error from GDAL is this:

ERROR 1: Error in fread() reading object of size 32 at offset 212 from .shp file

The issue feels similar to https://trac.osgeo.org/gdal/ticket/4203 but that one is fixed. However, I believe that the 3rd party software makes invalid shapefiles. A workaround that probably works is to
  1. delete the .shx file
  2. re-create .shx with ogrinfo

ogrinfo test_layout.shp -al --config SHAPE_RESTORE_SHX true

#2 Updated by Nyall Dawson over 7 years ago

  • Resolution set to up/downstream
  • Status changed from Open to Closed

Not a QGIS issue - this needs to be fixed in either GDAL's reading of the file or in the application which created the invalid shapefile.

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

  • Category set to Unknown

Also available in: Atom PDF