[gdal-dev] vsis3/vsicurl allowed-extensions per path?

Sean Gillies sean at mapbox.com
Thu Oct 11 16:18:29 PDT 2018


Hi Rob,

On Wed, Oct 10, 2018 at 11:12 AM Robert Coup <robert.coup at koordinates.com>
wrote:

> Hi Sean,
>
> Configuration management doesn't have to be so bad. I have an example of
>> how to do Rasterio-style configuration contexts, including reset, using
>> GDAL's Python bindings at
>>
>>
>> https://rasterio.readthedocs.io/en/latest/topics/configuration.html#gdal-example
>>
>
> (I love context managers)
>
> How does it handle multiple open datasets with different configurations
> though? AFAIK underneath there's only one per-thread config in GDAL, not
> one per dataset? Or does it push/pop configurations every time you call the
> underlying GDAL functions?
>
> Cheers,
>
> Rob :)
>

I don't have a pushing and popping dataset wrapper handy, but I think that
would work. In Python it would be something like the following right?

  wrapper = ConfigWrapper(gdal.Open(path),
CPL_VSIL_CURL_ALLOWED_EXTENSIONS=".tif")
  data = wrapper.ReadAsArray()

With the wrapper pushing that config option before it delegates and popping
it after. As near as I can tell, CPL_VSIL_CURL_ALLOWED_EXTENSIONS only
influences the Open() and Stat() calls for /vsicurl, so maybe the above
would be overkill. Calling ReadAsArray shouldn't trigger a scan of
auxiliary files.

-- 
Sean Gillies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20181011/39d7b5d6/attachment.html>


More information about the gdal-dev mailing list