13 Jun

Set the GDAL_DATA Environment Variable Programmatically in C#

You can set programmatically to the GDAL_DATA environment variable as follow.

Sample code:

string path = @"C:\gdal\";
SetValueNewVariable("GDAL_DATA", path + "\\data");
SetValueNewVariable("GEOTIFF_CSV", path + "\\data");
SetValueNewVariable("GDAL_DRIVER_PATH", path + "\\gdalplugins");

private static void SetValueNewVariable(string var, string value)
    if (System.Environment.GetEnvironmentVariable(var) == null)
       System.Environment.SetEnvironmentVariable(var, value);

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Your IP has been flagged as spam/malicious.