I would like to use ogrinfo.exe through a command line to query the SRID of a layer (e.g., polygon layer) inside an ESRI GDB. Similarly to SpatialReference.GetAuthorityCode() when using GDAL Python package.
I saw the GDAL documentation about OGR layer SQL functions here.
My understanding was that ogr_layer_SRID() function operates on a layer name, therefore I tried the following:
ogrinfo.exe file_name.gdb -dialect SQLite -sql "SELECT ogr_layer_SRID(Layer_Name) as SRID"
But I had the error below:
ERROR 1: In ExecuteSQL(): sqlite3_prepare_v2(SELECT ogr_layer_SRID(layer_name) as SRID): no such column: layer_name
I then tried the below query, which uses the "shape" column as the function argument, but it is trying to return the SRID for each record of the layer instead of the layer SRID:
ogrinfo.exe file_name.gdb -dialect SQLite -sql "SELECT ogr_layer_SRID(shape) as SRID FROM Layer_Name"
...returning the error below:
ERROR 1: VirtualOGR: OGR2SQLITE_ogr_layer_SRID(): Invalid argument type
and something like the below for each record:
OGRFeature(SELECT):3420 SRID (String) = (null)