[gdal-dev] GDAL2 Python ds.GetDescription() is empty
Gong, Shawn
shawn.gong at mdacorporation.com
Tue Jan 15 18:02:43 PST 2019
Hi Even,
Yes,
GDAL_ARRAY_OPEN_BY_FILENAME=YES as configuration option/env variable has made gdal.Open('NUMPY:::xxxx') working for me.
I need this option as many codes were written to display imageData, while not saving imageData on disk.
I am going to do:
output_ds = gdal.Open(gdal_array.GetArrayFilename(imageData))
gdal_array.CopyDatasetInfo(org_dataset, output_ds, offsetX, offsetY)
Thank you!
Shawn
________________________________________
From: Even Rouault [even.rouault at spatialys.com]
Sent: January-15-19 3:18 PM
To: gdal-dev at lists.osgeo.org
Cc: Gong, Shawn
Subject: Re: [gdal-dev] GDAL2 Python ds.GetDescription() is empty
Shawn,
>
> I am using Python 2.7
> In my work, results are displayed like this:
> imageData =
> output_ds = gdal_array.OpenArray(imageData)
> output_ds.GetDescription()
> RasterLayer(ds=output_ds)
>
> in GDAL1.9, output_ds.GetDescription() = 'NUMPY:::027D64D0'
> I use that unique name to instantiate a raster layer.
> But in GDAL2, output_ds.GetDescription() = '' # an empty str
> Why is that?
For security reasons. Opening NUMPY:::random_address could crash GDAL
So unless you define GDAL_ARRAY_OPEN_BY_FILENAME=YES as configuration option/
env variable, gdal.Open('NUMPY:::xxxx') won't work anymore.
SetDescription() is indeed no longer set, not sure if I really intended it
(kind of makes sense, if gdal.Open() doesn't work on it anymore by default).
Anyway, you can get the connection string with
gdal_array.GetArrayFilename(imageData).
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the gdal-dev
mailing list