[gdal-dev] VRT derived band, pixel functions and Python bindings

Armin Burger armin.burger at gmx.net
Thu Mar 22 16:52:03 EDT 2012


On 22/03/2012 21:00, Even Rouault wrote:
> Le jeudi 22 mars 2012 19:26:56, Armin Burger a écrit :
>> Hi all
>>
>> I set up 2 pixel functions to be used with VRT images and derived bands.
>> This works fine with the GDAL utilities and also with MapServer and
>> Python MapScript.
>>
>> If I try however to load the pixel functions in GDAL-Python as drivers,
>> I run into problems. The following code
>>
>>     from osgeo import gdal
>>     import os
>>
>>     os.putenv("GDAL_DRIVER_PATH", "/usr/local/share/gdal/gdalplugins")
>>     gdal.AllRegister()
>>
>> produces the error:
>>
>> python: symbol lookup error: /usr/local/share/gdal/gdalplugins
>> /gdal_SpotBlue.so: undefined symbol: GDALAddDerivedBandPixelFunc
>>
>>
>> So is this sort of a bug or is this functionality not available via the
>> GDAL Python bindings? Environment is Linux, GDAL 1.9, Python 2.6.
>
> No fundamental reason it should not work. I'm pretty sure to have done that in
> the past. Did you make sure that your gdal_SpotBlue.so links to libgdal.so
> (check with ldd) ? But I'm not sure why loading throug python would make a
> difference w.r.t loading with GDAL utilities or MapServer.

Even

compilation was with

gcc -fPIC -c SpotBlue.c
gcc -shared SpotBlue.o -o SpotBlue.so


So no spacial linking against libgdal.so. ldd therefore does not report 
anything related to the libgdal.so. But since it directly worked from 
the normal GDAL utilities and MapScript I did not check anything further.

What would be your suggestion for additional flags to add for the 
compilation?

Armin



More information about the gdal-dev mailing list