[GIS] gdal_translate : projection error

anacondagdalgdal-translate

I am using GDAL library routines to build a tiled hierarchy of images for use with
Google Earth. The images are just PNG files created using Matplotlib. To tile the images, we are using gdal_translate, gdalwarp and gdal2tiles.py. When using the Macports installation of GDAL (installed via sudo port install gdal, everything works beautifully, and the tiled hierarchy is created and loads into Google Earth. But for reasons I don't understand, the Anaconda installation is giving us an error.

Here is the results of gdalinfo on a typical PNG file that we produce :

% gdalinfo plot.png
Driver: PNG/Portable Network Graphics
Files: plot.png
Size is 2400, 2400
Coordinate System is `'
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0, 2400.0)
Upper Right ( 2400.0,    0.0)
Lower Right ( 2400.0, 2400.0)
Center      ( 1200.0, 1200.0)
Band 1 Block=2400x1 Type=Byte, ColorInterp=Red
  Mask Flags: PER_DATASET ALPHA 
Band 2 Block=2400x1 Type=Byte, ColorInterp=Green
  Mask Flags: PER_DATASET ALPHA 
Band 3 Block=2400x1 Type=Byte, ColorInterp=Blue
  Mask Flags: PER_DATASET ALPHA 
Band 4 Block=2400x1 Type=Byte, ColorInterp=Alpha

The image we are loading is assumed to be in lat/lon coordinates.

When we use the Macports installation of gdal_translate, things work :

/opt/local/bin/gdal_translate -of VRT -a_srs EPSG:4326 -gcp 0 0 -120   0  -gcp     2400     0  -60   0 -gcp 2400  2400  -60 -60 -90 plot.png plot_tmp.vrt
Input file size is 2400, 2400

The file plot_tmp.vrt is created, and can be used by gdalwarp and gdal2tiles.py.

However, the same call to the Anaconda installation of gdal_translate gives us an error :

/anaconda/bin/gdal_translate -of VRT -a_srs EPSG:4326 -gcp 0 0 -120   0  -gcp 2400     0  -60   0 -gcp 2400  2400  -60 -60 -90 plot.png plot_tmp.vrt
ERROR 6: EPSG PCS/GCS code 4326 not found in EPSG support files.  Is this a valid EPSG coordinate system?
Failed to process SRS definition: EPSG:4326

I have GDAL_DATA set to an existing file gcs.cvs (although this doesn't seem to matter, as the MacPorts installation doesn't need this file).

I have exactly the same installed versions in both cases :

/anaconda/bin/gdal_translate --version
GDAL 1.11.2, released 2015/02/10

/opt/local/bin/gdal_translate --version
GDAL 1.11.2, released 2015/02/10

Is the Anaconda installation broken? Or is it making assumptions that the MacPorts version isn't? Or, maybe the Macports version is picking up something in my PATH that the Anaconda version isn't?

We would like to build these tiling capabilities into a visualization package were are developing, and don't want users to have to rely on one installation over the other (especially since we tell users to install Anaconda Python!)

(I apologize for the cross-posting this question, but I just now discovered this stack-exchange site, and don't yet know how to migrate my question).

Best Answer

As of a week or so ago, the Anaconda packaging of GDAL now includes all of the projection files. The install command for the Anaconda packaging of GDAL is

% conda install gdal

The projection files are stored under $ANACONDA/gdal/share$ so settingGDAL_DATA` to this path is all that is needed to avoid the problems I was having above.

% export GDAL_DATA=$ANACONDA/share/gdal

No more need to rely on MacPorts, Frameworks, HomeBrew, gdal.org and so on for these additional files.

Related Question