Local GDAL on Webfaction

After getting a Django app to read a .GML (Geography Markup Language) file, I noticed this did not work on Webfaction. After uploading the .GML, Django gave the following error trying to read the datasource:

raise OGRException('Could not open the datasource at "%s"' % ds_input)

Thinking this might be a difference between my local GDAL version and the one on my webhost. I tried:

gdal-config --version

Which gave GDAL 1.5.3 on Webfaction and GDAL 1.10.1 on my computer. I decided to try and install a local version of GDAL on Webfaction.

In my home directory on Webfaction:

$ mkdir src
$ cd scr
$ svn checkout https://svn.osgeo.org/gdal/branches/1.10/gdal gdal
$ cd gdal
$ ./configure --prefix=$HOME  --with-python=/usr/local/bin/python2.7  --with-expat=yes
$ make
$ make install

Next I added the location of my local GDAL library to the settings.py of my Django project.

GDAL_LIBRARY_PATH = '/home/user123/lib/libgdal.so'

And restarted Apache.

That fixed it.

Sources

comments powered by Disqus