Hi Rob, On Wed, Oct 10, 2018 at 11:12 AM Robert Coup <robert.c...@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
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev