OSGeo / gdal

GDAL is an open source MIT licensed translator library for raster and vector geospatial data formats.
https://gdal.org
Other
4.77k stars 2.5k forks source link

using GDAL SetConfigOption in Jupyter Notebook running on docker is not possible #8949

Closed hamidbehbood closed 9 months ago

hamidbehbood commented 9 months ago

GDAL SetConfigOption in Jupyter Notebook running on docker is not possible

I am trying to use GDAL in Jupyter Notebook which is running on the docker environment, the GDAL library works fine but when it comes to set a configuration by using SetConfigOption it does not work.

Steps to reproduce the problem.

I am using Use jupyter/minimal-notebook image in the docker file and I did t install GDAL on the image as dependencies by using pip and conda but none of them seems to be responding to SetConfigOption , and when I am using the GDAL in Jupyter Notebook in windows everything seems to be in order .

(When I print the SetConfigOption it says that the configuration has been set but in reality, it does not affect anything.)

Operating system

Windows 11 and docker

GDAL version and provenance

version 3.8

rouault commented 9 months ago

ok, so you've also asked the question there: https://stackoverflow.com/questions/77603067/trouble-with-using-gdal-setconfigoption-in-jupyter-notebook-running-on-docker

The issue is likely that you need to explicitly close the dataset returned by gdal.VectorTranslate():

ds = gdal.VectorTranslate(....)
del ds  # ogr ds.Close() with GDAL >= 3.8.0