@@ -108,6 +108,41 @@ void GDALRasterIndexAlgorithm::AddCommonOptions()
108108
109109 AddArg (" skip-errors" , 0 , _ (" Skip errors related to input datasets" ),
110110 &m_skipErrors);
111+ AddArg (" profile" , 0 , _ (" Profile of output dataset" ), &m_profile)
112+ .SetDefault (m_profile)
113+ .SetChoices (PROFILE_NONE, PROFILE_STAC_GEOPARQUET);
114+ AddArg (" base-url" , 0 , _ (" Base URL for STAC-GeoParquet href" ), &m_baseUrl);
115+ AddArg (" id-method" , 0 , _ (" How to derive STAC-GeoParquet 'id'" ), &m_idMethod)
116+ .SetDefault (m_idMethod)
117+ .SetChoices (ID_METHOD_FILENAME, ID_METHOD_MD5, ID_METHOD_METADATA_ITEM);
118+ AddArg (" id-metadata-item" , 0 ,
119+ _ (" Name of metadata item used to set STAC-GeoParquet 'id'" ),
120+ &m_idMetadataItem)
121+ .SetDefault (m_idMetadataItem)
122+ .AddValidationAction (
123+ [this ]()
124+ {
125+ m_idMethod = ID_METHOD_METADATA_ITEM;
126+ return true ;
127+ });
128+
129+ AddValidationAction (
130+ [this ]()
131+ {
132+ if (m_profile == PROFILE_STAC_GEOPARQUET)
133+ {
134+ if (!m_outputFormat.empty () &&
135+ !EQUAL (m_outputFormat.c_str (), " Parquet" ))
136+ {
137+ ReportError (CE_Failure, CPLE_NotSupported,
138+ " STAC-GeoParquet profile is only compatible "
139+ " with Parquet output format" );
140+ return false ;
141+ }
142+ m_outputFormat = " Parquet" ;
143+ }
144+ return true ;
145+ });
111146}
112147
113148/* ***********************************************************************/
@@ -140,6 +175,24 @@ bool GDALRasterIndexAlgorithm::RunImpl(GDALProgressFunc pfnProgress,
140175 CPLStringList aosOptions;
141176 aosOptions.push_back (" --invoked-from-gdal-raster-index" );
142177
178+ if (m_profile != PROFILE_NONE)
179+ {
180+ aosOptions.push_back (" -profile" );
181+ aosOptions.push_back (m_profile);
182+
183+ if (!m_baseUrl.empty ())
184+ {
185+ aosOptions.push_back (" --base-url" );
186+ aosOptions.push_back (m_baseUrl);
187+ }
188+
189+ aosOptions.push_back (" --id-metadata-item" );
190+ aosOptions.push_back (m_idMetadataItem);
191+
192+ aosOptions.push_back (" --id-method" );
193+ aosOptions.push_back (m_idMethod);
194+ }
195+
143196 if (m_skipErrors)
144197 {
145198 aosOptions.push_back (" -skip_errors" );
0 commit comments