Search code examples
gdal

How to set the GDAL_DATA environment variable to point to the directory containing EPSG csv files?


I want to wrap(re-project) one variable in this netcdf file.

D:\ gdalwarp -t_srs EPSG:4326 NETCDF:"C:\fie.nc":var "C:\Desktop\SM.img"

But I get this error:

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.

ERROR 1: Translating source or target SRS failed: EPSG:4326

I am using GDAL 1.9.0, released 2011/12/29. I will be grateful for any help.


Solution

  • You can edit the environment variables graphically in Windows (e.g., this, or this).

    Add a System variable with name GDAL_DATA and value of the path to the shared GDAL data (a folder with a several files, like coordinate_axis.csv, gcs.csv, pcs.csv, and other files).

    To make the environment variable effective, you need to run cmd.exe, or log-out, or other method.

    See also: http://trac.osgeo.org/gdal/wiki/FAQInstallationAndBuilding#HowtosetGDAL_DATAvariable


    Anaconda / Miniconda users

    GDAL library and command-line tools are available via (e.g.) conda install gdal

    The GDAL_DATA variable is properly set when the environment is activated. This is done for you if you start an Anaconda Prompt, otherwise you can activate the environment as documented.