From 8dd8c815d61e42b789e9d8f4ade372e7bb811b64 Mon Sep 17 00:00:00 2001
From: Even Rouault <even.rouault@spatialys.com>
Date: Thu, 30 Jan 2025 12:22:54 +0100
Subject: [PATCH] STACIT Identify(): accept if at least 2 of 'proj:transform',
 'proj:bbox' or 'proj:shape' are present

---
 frmts/stacit/stacitdataset.cpp | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/frmts/stacit/stacitdataset.cpp b/frmts/stacit/stacitdataset.cpp
index 51f8510eef55..0a7396fe2542 100644
--- a/frmts/stacit/stacitdataset.cpp
+++ b/frmts/stacit/stacitdataset.cpp
@@ -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)