New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
False positive ? "ERROR 1: Inconsistent shape count for bin" #106
Comments
Can reproduce. It's line 540 of sbnsearch.c that prints the error message. SBNSearchHandle handle = SBNOpenDiskTree("glwd_2.sbn", NULL);
int shapeCount;
const double boundsMin[2] = {5, 5};
const double boundsMax[2] = {6, 6};
int *ids = SBNSearchDiskTree(handle, boundsMin, boundsMax, &shapeCount);
SBNSearchFreeIds(ids);
SBNCloseDiskTree(handle); |
This likely is not the correct patch, but it prevents the error: diff --git a/sbnsearch.c b/sbnsearch.c
index be08021..52e807f 100644
--- a/sbnsearch.c
+++ b/sbnsearch.c
@@ -533,6 +533,11 @@ static bool SBNSearchDiskInternal(SearchStruct *psSearch, int nDepth,
return false;
}
+ if (nShapeCountAcc == psNode->nShapeCount)
+ {
+ break;
+ }
+
if (nShapeCountAcc + nShapes > psNode->nShapeCount)
{
free(psNode->pabyShapeDesc); |
rouault
added a commit
to rouault/shapelib
that referenced
this issue
Mar 10, 2024
…sing nBinStart Fixes OSGeo#106 / OSGeo/gdal#9430
rouault
added a commit
to rouault/gdal
that referenced
this issue
Mar 10, 2024
…ors with non-increasing nBinStart Fixes OSGeo/shapelib#106 / OSGeo#9430
rouault
added a commit
to rouault/gdal
that referenced
this issue
Mar 10, 2024
…ors with non-increasing nBinStart Fixes OSGeo/shapelib#106 / OSGeo#9430
rouault
added a commit
to rouault/shapelib
that referenced
this issue
Mar 10, 2024
…sing nBinStart Fixes OSGeo#106 / OSGeo/gdal#9430
rouault
added a commit
to rouault/shapelib
that referenced
this issue
Mar 10, 2024
…sing nBinStart Fixes OSGeo#106 / OSGeo/gdal#9430
rouault
added a commit
to rouault/shapelib
that referenced
this issue
Mar 10, 2024
…sing nBinStart Fixes OSGeo#106 / OSGeo/gdal#9430
rouault
added a commit
to rouault/gdal
that referenced
this issue
Mar 10, 2024
…ors with non-increasing nBinStart Fixes OSGeo/shapelib#106 / OSGeo#9430
rouault
added a commit
to rouault/gdal
that referenced
this issue
Mar 10, 2024
…ors with non-increasing nBinStart Fixes OSGeo/shapelib#106 / OSGeo#9430
rouault
added a commit
to rouault/shapelib
that referenced
this issue
Mar 15, 2024
…sing nBinStart Fixes OSGeo#106 / OSGeo/gdal#9430
rouault
added a commit
to rouault/gdal
that referenced
this issue
Mar 15, 2024
…ors with non-increasing nBinStart Fixes OSGeo/shapelib#106 / OSGeo#9430
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's a dataset (Shapefile with spatial index .sbn / .sbx)
for which
ogrinfo
returns:What makes me wonder, is that this dataset originated from and is widely used in scientific context, and AFAICS nobody complained about a corrupt spatial index so far.
So could it be, that the index is correct and the shown error is a false positive?
Looks like the error comes from here:
shapelib/sbnsearch.c
Line 540 in 644559c
shapelib/sbnsearch.c
Line 642 in 644559c
The text was updated successfully, but these errors were encountered: