1

I'm trying to use gdal_rasterize inside MATLAB via UNIX or system MATLAB command

system('gdal_rasterize').

Despite this command working in my console terminal, I get the following error inside MATLAB:

gdal_rasterize: symbol lookup error: /usr/lib/libgdal.so.1: undefined symbol: pj_ctx_alloc

2

I try to use gdal in Matlab and I had same issue and I solved it in this manner.

I tried both on Matlab 2011a and 2013a and probably solution is quite similar.

Mainly, the problem is with proj library and if you try to launch it

1) on bash (gnome-terminal) probably you have proj

>> proj
Rel. 4.8.0, 6 March 2012
>> which proj
/usr/local/bin/proj

2) on Matlab (on command line) if you try you could see following result:

>> system('proj')
Rel. 4.4.9, 4 March 2004 
>> system('which proj')
/usr/local/bin/proj

I don't know why but this is the problem; you have undefined symbol: pj_ctx_alloc when proj is less then 4.8.0 and matlab in its workspace found a wrong library version.

To solve this you have to create a link from your library and matlab that is:

cd /usr/local/MATLAB/R2013a/sys/os/glnxa64 
sudo ln -s /usr/lib/libproj.so.0

you have to check if your libproj.so.0 is located in /usr/lib/ or in another folder on your machine.

Obviously proj must be installed on your system.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.