@@ -1969,13 +1969,15 @@ bool GDALTileIndexDataset::Open(GDALOpenInfo *poOpenInfo)
19691969 std::vector<double > adfOffset;
19701970 if (bIsStacGeoParquet && poFeature)
19711971 {
1972- const int nEOBandsIdx = poLayerDefn->GetFieldIndex (
1972+ int nBandsIdx = poLayerDefn->GetFieldIndex (
19731973 CPLSPrintf (" assets.%s.eo:bands" , osAssetName.c_str ()));
1974- if (nEOBandsIdx >= 0 &&
1975- poLayerDefn->GetFieldDefn (nEOBandsIdx)->GetSubType () == OFSTJSON &&
1976- poFeature->IsFieldSet (nEOBandsIdx))
1974+ if (nBandsIdx < 0 )
1975+ nBandsIdx = poLayerDefn->GetFieldIndex (" bands" );
1976+ if (nBandsIdx >= 0 &&
1977+ poLayerDefn->GetFieldDefn (nBandsIdx)->GetSubType () == OFSTJSON &&
1978+ poFeature->IsFieldSet (nBandsIdx))
19771979 {
1978- const char *pszStr = poFeature->GetFieldAsString (nEOBandsIdx );
1980+ const char *pszStr = poFeature->GetFieldAsString (nBandsIdx );
19791981 CPLJSONDocument oDoc;
19801982 if (oDoc.LoadMemory (pszStr) &&
19811983 oDoc.GetRoot ().GetType () == CPLJSONObject::Type::Array)
@@ -1991,8 +1993,9 @@ bool GDALTileIndexDataset::Open(GDALOpenInfo *poOpenInfo)
19911993 {
19921994 if (oObj.GetType () == CPLJSONObject::Type::Object)
19931995 {
1994- const auto osCommonName =
1995- oObj.GetString (" common_name" );
1996+ auto osCommonName = oObj.GetString (" common_name" );
1997+ if (osCommonName.empty ())
1998+ osCommonName = oObj.GetString (" eo:common_name" );
19961999 const auto eInterp =
19972000 GDALGetColorInterpFromSTACCommonName (
19982001 osCommonName.c_str ());
@@ -2017,17 +2020,25 @@ bool GDALTileIndexDataset::Open(GDALOpenInfo *poOpenInfo)
20172020
20182021 adfCenterWavelength[i] =
20192022 oObj.GetDouble (" center_wavelength" );
2023+ if (adfCenterWavelength[i] == 0 )
2024+ adfCenterWavelength[i] =
2025+ oObj.GetDouble (" eo:center_wavelength" );
20202026 adfFullWidthHalfMax[i] =
20212027 oObj.GetDouble (" full_width_half_max" );
2028+ if (adfFullWidthHalfMax[i] == 0 )
2029+ adfFullWidthHalfMax[i] =
2030+ oObj.GetDouble (" eo:full_width_half_max" );
20222031 }
20232032 ++i;
20242033 }
20252034 }
20262035 }
20272036 }
20282037
2029- const int nRasterBandsIdx = poLayerDefn->GetFieldIndex (
2038+ int nRasterBandsIdx = poLayerDefn->GetFieldIndex (
20302039 CPLSPrintf (" assets.%s.raster:bands" , osAssetName.c_str ()));
2040+ if (nRasterBandsIdx < 0 )
2041+ nRasterBandsIdx = poLayerDefn->GetFieldIndex (" bands" );
20312042 if (nRasterBandsIdx >= 0 &&
20322043 poLayerDefn->GetFieldDefn (nRasterBandsIdx)->GetSubType () ==
20332044 OFSTJSON &&
0 commit comments