[gdal-dev] Fwd: Grep gdalinfo subdataset

Markus Neteler neteler at osgeo.org
Tue Dec 1 08:46:13 PST 2020


On Tue, Dec 1, 2020 at 3:08 PM 1520 gis
<juliermeopensourcedeveloper at gmail.com> wrote:
> From: 1520 gis <juliermeopensourcedeveloper at gmail.com>
> Date: Fri, Nov 27, 2020 at 3:14 PM
> Subject: Grep gdalinfo subdataset
> To: <gdal-dev at lists.osgeo.org>
>
>
> Hi all,
>
> I am trying to grep the SUBDATASET_X_NAME in gdalinfo.
> I only need the WCS:url
>
> If I grep the subdataset [1], the string slice "SUBDATASET_5_NAME" comes together. I would like to know if I can get only WCS:url by using any gdalinfo options.
>
> I tried running [2] , but no success.

Just a wild guess:
maybe it is easier to use the `-json` output and parse it (here: quick
Sentinel-2 example, not very elegant):

gdalinfo S2A_MSIL2A_20190912T025541_N0213_R032_T48MYT_20190912T065935.zip
-json | jq ".metadata" | jq ".SUBDATASETS" | jq ".SUBDATASET_2_NAME"
"SENTINEL2_L2A:/vsizip/S2A_MSIL2A_20190912T025541_N0213_R032_T48MYT_20190912T065935.zip/S2A_MSIL2A_20190912T025541_N0213_R032_T48MYT_20190912T065935.SAFE/MTD_MSIL2A.xml:20m:EPSG_32748"

cheers,
Markus


More information about the gdal-dev mailing list