2

I have been work with gdal in python 2.7 in windows 10 and Pycharm, and I can't fix the GDAL_DATA path in the environment. Because that I got this message:

ERROR 4: Unable to open EPSG support file gcs.csv. Try setting the GDAL_DATA environment variable to point to the directory containing EPSG csv files.

I try to use command line:

set GDAL_DATA='c:/Users/User/share/epsg_csv/'

And try to use the function inside the python code:

import os
os.environ["GDAL_DATA"] = 'c:/Users/User/share/epsg_csv/'

Any suggestion?

1 Answers1

3

For some reason that I do not understand the GDAL_DATA variable (and for that matter also the PROJ_LIB variable) are not set at installation of the GDAL packages with Anaconda 4.6.

To set these variables I do the following at the start of the program before calling any of the geo modules.

import os
os.environ['GDAL_DATA'] = os.environ['CONDA_PREFIX'] + r'\Library\share\gdal'
os.environ['PROJ_LIB'] = os.environ['CONDA_PREFIX'] + r'\Library\share'

For information for my conda environment the CONDA_PREFIX is:

c:\Users\<user_name>\Ananconda3\envs\<my_env>

Hope this helps.

Bruno Vermeulen
  • 2,970
  • 2
  • 15
  • 29