Il 15/05/2023 15:34, Andrea Giudiceandrea ha scritto:
it seems to me ogr fails to properly create the .idx [EDIT: .shx] file: it incorrectly stores, in the index file header, the total length in 16-bit words of the .shp file instead of the total length in 16-bit words of the .idx [EDIT: .shx] file itself.

Looking at the code, SHPRestoreSHX initially copies the SHP header (including the SHP content length) to the SHX file and then it doesn't updates the SHX content length in the SHX header when an error occurred during the reading of the SHP file.

I propose the PR https://github.com/OSGeo/gdal/pull/7774 in order to update the SHX content length even if an error occurred.

Maybe would it be better to let SHPRestoreSHX modify the SHX file (when already present) only at the end of the SHP reading procedure and only if no error occurred?

Best regards.

Andrea Giudiceandrea
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to