[gdal-dev] Issue with the STACIT usage examples

Sean Gillies sean.gillies at gmail.com
Fri Nov 22 06:43:55 PST 2024


Hi Even,

This episode is a reminder that making quotation marks part of the GDAL
filename syntax was a mistake. Reverting it would be a big effort, but at
the very least we should stop propagating it. Specifically, if a new driver
with subdataset capabilities were to be written tomorrow it should be
forbidden from relying on quotation marks

On Fri, Nov 22, 2024 at 5:32 AM Even Rouault via gdal-dev <
gdal-dev at lists.osgeo.org> wrote:

> If you struggle with quoting, the easiest would be to "alias" complex
> connections strings as VRT with
>
> gdal_translate "STACIT: .. complex stuff here.."  my_stacit.vrt
>
> and the use "vrt://my_stacit.vrt?...."
>
> There should be hardly any performance overhead doing that since the VRT
> driver is optimized to detect situations like that where it is used as a
> passthrough.
>
> On Linux/Unix you can actually avoid creating an actual vrt file and just
> create a symbolic link:
>
> $ ln -sf "STACIT:\
> "https://planetarycomputer.microsoft.com/api/stac/v1/search?collections=naip&bbox=-100,40,-99,41&datetime=2019-01-01T00:00:00Z%2F..\"
> <https://planetarycomputer.microsoft.com/api/stac/v1/search?collections=naip&bbox=-100,40,-99,41&datetime=2019-01-01T00:00:00Z%2F..%5C>:asset=image"
> my_stacit
> $ gdalinfo vrt://my_stacit
>
> That's a trick I use often to make it easier in QGIS to use such non-file
> datasets.
>
> Le 22/11/2024 à 10:53, Rahkonen Jukka via gdal-dev a écrit :
>
> Hi,
>
>
>
> In case of STACIT, I can’t discover how to use the vrt:// connection
> string
> https://gdal.org/en/latest/drivers/raster/vrt.html#vrt-connection-string
> with subdataset name (or even without). Can you?
>
> Start with
>  gdalinfo  "STACIT:\
> https://planetarycomputer.microsoft.com/api/stac/v1/search?collections=naip^&bbox=-100,40,-99,41^&datetime=2019-01-01T00:00:00Z%2F..\
> <https://planetarycomputer.microsoft.com/api/stac/v1/search?collections=naip%5E&bbox=-100,40,-99,41%5E&datetime=2019-01-01T00:00:00Z%2F..%5C>
> and try to show a vrt:// string for
>   SUBDATASET_1_NAME=STACIT:
> https://planetarycomputer.microsoft.com/api/stac/v1/search?collections=naip&bbox=-100,40,-99,41&datetime=2019-01-01T00:00:00Z%2F..:asset=image
>
>
>
> -Jukka-
>
>
>
> *Lähettäjä:* Michael Sumner <mdsumner at gmail.com> <mdsumner at gmail.com>
> *Lähetetty:* perjantai 22. marraskuuta 2024 11.10
> *Vastaanottaja:* Rahkonen Jukka <jukka.rahkonen at maanmittauslaitos.fi>
> <jukka.rahkonen at maanmittauslaitos.fi>
> *Aihe:* Re: [gdal-dev] Issue with the STACIT usage examples
>
>
>
>
>
> On Fri, 22 Nov 2024, 03:52 Rahkonen Jukka via gdal-dev, <
> gdal-dev at lists.osgeo.org> wrote:
>
> Understood, and good reason to start using the new gdalinfo convenience
> option "-sd" for selecting sub-datasets by their index.
>
>
>
> Do beware that index isn't necessarily reliable (good old netcdf), it can
> change through an ostensibly consistent dataset while name does remain
> robust.
>
>
>
> vrt:// has sd_name for this purpose, and to avoid driver declaration with
> full subdataset syntax.
>
>
>
> I may have considered sd_name for gdalinfo ?? probably a good idea. And
> maybe something to put on the 4.0 break list 🙏
>
>
>
> Cheers, Mike
>
>
>
> gdalinfo "STACIT:\
> https://paituli.csc.fi/geoserver/ogc/stac/v1/search?collections=corine_land_cover_at_geocubes\"
> -sd 2
>
>
>
> -Jukka-
>
>
>
> *Lähettäjä:* Even Rouault <even.rouault at spatialys.com>
> *Lähetetty:* torstai 21. marraskuuta 2024 18.36
> *Vastaanottaja:* Rahkonen Jukka <jukka.rahkonen at maanmittauslaitos.fi>;
> Daniel Evans <daniel.fred.evans at gmail.com>
> *Kopio:* 'gdal-dev at lists.osgeo.org' (gdal-dev at lists.osgeo.org) <
> gdal-dev at lists.osgeo.org>
> *Aihe:* Re: [gdal-dev] Issue with the STACIT usage examples
>
>
>
>
>
>
>
> However, the subdataset names on the list are not accepted as-is without
> small edits.
> Does not work:
> gdalinfo STACIT:
> "https://paituli.csc.fi/geoserver/ogc/stac/v1/search?collections=corine_land_cover_at_geocubes"
> <https://paituli.csc.fi/geoserver/ogc/stac/v1/search?collections=corine_land_cover_at_geocubes>
> :asset=1000m
>
> That's "expected". Subdataset names are designed to be used verbatim by
> GDALOpen(). The STACIT driver isn't aware it has been invoked from a shell
> and which quoting rules would apply.
>
>
>
>
>
-- 
Sean Gillies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20241122/f0a7e637/attachment-0001.htm>


More information about the gdal-dev mailing list