[gdal-dev] Open a string (json) as STACIT in python
Michael Smith
michael.smith.erdc at gmail.com
Mon Mar 11 11:38:54 PDT 2024
Works perfectly just had to do
myds=gdal.OpenEx("STACIT:/vsimem/temp_stacit.json")
Mike
On 3/11/24, 2:34 PM, "gdal-dev on behalf of Even Rouault via gdal-dev" <gdal-dev-bounces at lists.osgeo.org <mailto:gdal-dev-bounces at lists.osgeo.org> on behalf of gdal-dev at lists.osgeo.org <mailto:gdal-dev at lists.osgeo.org>> wrote:
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 <http://www.spatialys.com>
My software is free, but my time generally not.
_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org <mailto:gdal-dev at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/gdal-dev <https://lists.osgeo.org/mailman/listinfo/gdal-dev>
More information about the gdal-dev
mailing list