[gdal-dev] Sortshp and corrupted output with 3D polygon input
Jukka Rahkonen
jukka.rahkonen at mmmtike.fi
Tue Oct 12 06:01:43 EDT 2010
Hi,
I was sorting a shapefile with sortshp (Windows 2003 Server, GDAL 1.7.0dev,
FWTools 2.4.2, released 2009/06/24, from FWTools 2.4.2).
Sorting went OK well and it looks like the resulting sorted shapefile works with
Mapserver. However, I noticed that the file size of .shp file decreased from 307
KB in the original into 207 KB in the sorted file and started to wonder why.
I also noticed that I could not process the sorted shapefile further with
ogr2ogr. The result was one thousand times this kind of error message and
program stop:
ERROR 1: Corrupted .shp file : shape 978, nPoints=12, nParts=1, nEntitySize=248.
I discovered that the original shapefile I had was a 3D shapefile. Ogrinfo
reports that also the shapefile created by sortshp is of type 3D polygon.
ogrinfo -al -so error_sorted.shp
INFO: Open of `error_sorted.shp'
using driver `ESRI Shapefile' successful.
Layer name: error_sorted
Geometry: 3D Polygon
However, I have a feeling that perhaps it is not 3D Polygon layer but a normal
Polygon layer with wrong headers or something. I did another test by using an
intermediate 2D Polygon shapefile created by using ogr2ogr and option -lco
SHPT=POLYGON. Size of the resulting .shp file was 207 KB, just the same than the
invalid output from sortshp. Finally, sorting this 2D-shapefile with sortshp
gives me a valid sorted shapefile.
-Jukka Rahkonen-
More information about the gdal-dev
mailing list