[gdal-dev] Open a string (json) as STACIT in python
Even Rouault
even.rouault at spatialys.com
Mon Mar 11 11:34:17 PDT 2024
Mike,
Yes, the STACIT driver requires either a filename or STACIT:filename,
and doesn't support passing the content of the file in the connection string
An easy workaround is to do:
gdal.FileFromMemBuffer("/vsimem/temp_stacit.json", stac_string)
myds=gdal.OpenEx("/vsimem/temp_stacit.json")
gdal.Unlink("/vsimem/temp_stacit.json")
Even
Le 11/03/2024 à 19:30, Smith, Michael ERDC-RDE-CRREL-NH CIV via gdal-dev
a écrit :
> I’m building a stac item collection programmatically and I want to open that item collection in gdal using the python bindings. It all works if I save to a file or from a url (and I prefix with “STACIT:”) but I cannot seem to be able to open a variable containing json as STACIT. I have tried with
>
> myds = gdal.OpenEx(stac_string, allowed_drivers=["STACIT"])
> or
> myds = gdal.OpenEx("STACIT: "+stac_string)
>
> I can open the json as myds = gdal.OpenEx(stac_string) but then its treated as geojson and I cannot figure out how to convert/treat it as STACIT.
>
> Mike
>
>
--
http://www.spatialys.com
My software is free, but my time generally not.
More information about the gdal-dev
mailing list