1

Doing some stuff on OGR in Java - specifically importing a spatial reference from EPSG code, 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.

Problem is (unlike the other question on stack I saw about the same error) that I already have a GDAL_DATA in my user environment variables (win7) pointing to C:\Program Files\GDAL\gdal-data where gcs.csv exists.

I do have the line -Djava.library.path="C:\Program Files\GDAL\" in my project's runtime options to ensure GDAL is linked (even though I have an env variable PATH pointing there as well), do I need to do something similar to that or in the code to force/set the GDAL_DATA environment variable or is that not the problem and is this something else? (wouldn't be the first time GDAL/OGR bindings have been weird on me)

wowohweewah
  • 429
  • 5
  • 16
  • 1
    You could try to double-check whether GDAL_DATA is set in your java process. You can check using `System.getenv("...")`. And if not, even though it would not be a clean solution to your issue, you could get it working by setting GDAL_DATA programmatically, either in a new process (with ProcessBuilder) or, more complicated, in your process (like in http://stackoverflow.com/questions/580085/is-it-possible-to-set-an-environment-variable-at-runtime-from-java). – fedemp Jun 02 '14 at 20:27
  • Thanks, tried that and it worked fine (showed the right folderpath). Must be something odd with GDAL. – wowohweewah Jun 02 '14 at 20:47

0 Answers0