Skip to content

Commit

Permalink
STACIT Identify(): accept if at least 2 of 'proj:transform', 'proj:bb…
Browse files Browse the repository at this point in the history
…ox' or 'proj:shape' are present
  • Loading branch information
rouault committed Jan 30, 2025
1 parent eea5941 commit 8dd8c81
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions frmts/stacit/stacitdataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,19 @@ int STACITDataset::Identify(GDALOpenInfo *poOpenInfo)
return pszHeader[0] == '{';
}

if (strstr(pszHeader, "\"stac_version\"") != nullptr &&
(strstr(pszHeader, "\"proj:transform\"") != nullptr ||
strstr(pszHeader, "\"proj:bbox\"") != nullptr))
if (strstr(pszHeader, "\"stac_version\"") != nullptr)
{
return true;
int nTransformBBOXShapeCount = 0;
for (const char *pszItem :
{"\"proj:transform\"", "\"proj:bbox\"", "\"proj:shape\""})
{
if (strstr(pszHeader, pszItem))
nTransformBBOXShapeCount++;
}
if (nTransformBBOXShapeCount >= 2)
{
return true;
}
}

if (i == 0)
Expand Down

0 comments on commit 8dd8c81

Please sign in to comment.