Hi Vincent and List, You are correct, the library was not in my path and the command you suggested worked perfectly. I think the problem lies in the number of versions of gdal I have installed on my machine. I have a recently downloaded svn version of gdal, gdal 1.5.2 and gdal 1.4.4. Version 1.4.4 was installed using synaptic (Ubuntu Hardy Heron), the svn version and 1.5.2 are both local installs compiled from source. gdal_translate etc all find their libraries from the synaptic version (I tried to find these but could not??) while FillNoData now gets its libraries from a local install. Managing the different versions is perhaps the source of my problem. I am in the process of learning to use OTB which requires gdal 1.5.2 and I downloaded the svn version of gdal for the original gdal_fillnodata which I could not get going, hence my previous mail regarding that. So yes, perhaps I need to manage my installs a bit better.
Having said all this I now get a segmentation fault when I run the prog... will investigate to see what the problem is Many thanks to Brent and Vincent for your help, much appreciated Wesley Wesley Roberts MSc. Researcher: Earth Observation (Ecosystems) Natural Resources and the Environment CSIR Tel: +27 (21) 888-2490 Fax: +27 (21) 888-2693 "To know the road ahead, ask those coming back." - Chinese proverb >>> Vincent Schut <sc...@sarvision.nl> 03/27/09 9:46 AM >>> Wesley Roberts wrote: > Dear list, > > Sometime last week I posted a question regarding errors associated with > gdal_fillnodata. Brent Fraser kindly shared with me some C++ code he had > written to approximate the workings of the python gdal_fillnodata app. > Through trial and error (and some extra help from Brent) I have finally > gotten the code to work and compile using the following command > > wrobe...@wroberts-desktop:/usr/local/gdal/include$ sudo g++ > -I/usr/include/gdal gdal_FillNoData.cpp -L/usr/local/gdal/lib -lgdal -o > FillNoData > > unfortunately once compiled I try to run it for usage info and I get the > following error > > wrobe...@wroberts-desktop:/usr/local/gdal/include$ ./FillNoData > ./FillNoData: error while loading shared libraries: libgdal.so.1: cannot > open shared object file: No such file or directory > > I am a little lost as the file libgdal.so.1 is located in > > wrobe...@wroberts-desktop:/usr/local/gdal/lib$ ls -l > total 64212 > -rw-r--r-- 1 root root 40876082 2009-03-17 10:09 libgdal.a > -rwxr-xr-x 1 root root 1393 2009-03-17 10:09 libgdal.la > lrwxrwxrwx 1 root root 17 2009-03-17 10:09 libgdal.so -> > libgdal.so.1.13.0 > lrwxrwxrwx 1 root root 17 2009-03-17 10:09 libgdal.so.1 -> > libgdal.so.1.13.0 > -rwxr-xr-x 1 root root 24795259 2009-03-17 10:09 libgdal.so.1.13.0 > > I now see that libgdal.so.1 is infact a link to another file. > Unfortunately I have done a 'find' for libgdal.so.1 and have tried many > combinations of paths to gdal lib folders and this is the only one that > actually compiles. > Hi Wesley, it being a link is fine. First thing to check is if this directory '/usr/local/gdal/libs' is in your library search path. Check it by running your program as follows: LD_LIBRARY_PATH=/usr/local/gdal/lib ./FillNoData If this does not give you this error, the problem is your lib search path (I wonder however how your other gdal utilities, think gdal_translate etc. *do* find this lib then???). To add a directory to your system's lib search path permanently, you can (as root) add it to the file /etc/ld.so.conf. For a less permanent solution you could export it from your ~/.bashrc I think. If it still does not work, please report back to the list. Regards, Vincent. > I would like to use the app to fill the gaps in Landsat ETM+ data > (SLC-off). > > Does anyone on the list have ideas with regards to finding a solution to > my problem? Any help would be greatly appreciated. > > Kind regards, > Wesley > > > >>>> Brent Fraser <bfra...@geoanalytic.com> 03/26/09 4:38 P> steps to creating >>>> an executable: > > 1. The compile step. gcc needs to be able to find any "include" files > referenced in the source code. You've somewhat solved this by compiling > in the GDAL include directory. You may want to look into how specify > additional include directories on the gcc command line (a -I option?). > > 2. The link step. gcc needs to be able to find compiled libraries of > functions referenced in the c++ code. This is the problem you've shown > below. You need to specify the GDAL library on the gcc command line; > something like: > > g++ gdal_FillNoData.cpp -L../lib -lgdal -o fill_no_data > > > I found http://www.network-theory.co.uk/docs/gccintro/gccintro_17.html > to be a good gcc intro. And Frank Warmerdam gave some insight in > http://n2.nabble.com/gdal_priv.h-not-found-on-ubuntu-td2035784.html > > Best Regards, > Brent Fraser > > > Wesley Roberts wrote: > >> Hi Brent, >> >> Many thanks for your code and apologies for not replying sooner, >> > things > >> have been a little busy here. As you mentioned in your mail the code >> > may > >> need some tweaking, I received some >> >> warning: deprecated conversion from string constant to ‘char >> >> errors but have managed to sort those out through trial and error. I >> also had trouble with the include files so am now compiling from >> > inside > >> the gdal directory on usr/local/gdal/include. This is something I will >> remedy later on, for now I am receiving the following errors and given >> my inexperience using c++ I am not able to correct the code. Could you >> please help me? Error is below. >> >> Many thanks, >> Wesley >> >> >> wrobe...@wroberts-desktop:/usr/local/gdal/include$ sudo g++ >> gdal_FillNoData.cpp -o fill_no_data >> /tmp/ccz4jVWn.o: In function `ga_CopyBand(void*, void*, int, int)': >> gdal_FillNoData.cpp:(.text+0x14b): undefined reference to >> `GDALGetBlockSize' >> gdal_FillNoData.cpp:(.text+0x156): undefined reference to >> `GDALGetRasterDataType' >> gdal_FillNoData.cpp:(.text+0x164): undefined reference to >> `GDALGetDataTypeSize' >> gdal_FillNoData.cpp:(.text+0x241): undefined reference to >> > `GDALRasterIO' > >> gdal_FillNoData.cpp:(.text+0x29c): undefined referen> gdal_FillNoData.cpp:(.text+0x2e0): undefined reference to >> `GDALGetGeoTransform' >> gdal_FillNoData.cpp:(.text+0x2fb): undefined reference to >> `GDALSetGeoTransform' >> gdal_FillNoData.cpp:(.text+0x306): undefined reference to >> `GDALGetProjectionRef' >> gdal_FillNoData.cpp:(.text+0x315): undefined reference to >> `GDALSetProjection' >> /tmp/ccz4jVWn.o: In function `ga_World2Image(double, double, double*, >> long*, long*)': >> gdal_FillNoData.cpp:(.text+0x38b): undefined reference to >> `GDALInvGeoTransform' >> gdal_FillNoData.cpp:(.text+0x3b2): undefined reference to >> `GDALApplyGeoTransform' >> /tmp/ccz4jVWn.o: In function `ga_Image2World(long, long, double*, >> double*, double*)': >> gdal_FillNoData.cpp:(.text+0x467): undefined reference to >> `GDALApplyGeoTransform' >> /tmp/ccz4jVWn.o: In function `app_version(_IO_FILE*)': >> gdal_FillNoData.cpp:(.text+0x4c1): undefined reference to >> `GDALVersionInfo' >> /tmp/ccz4jVWn.o: In function `main': >> gdal_FillNoData.cpp:(.text+0x66d): undefined reference to >> `GDALTermProgress' >> gdal_FillNoData.cpp:(.text+0x6c8): undefined reference to >> `GDALAllRegister' >> gdal_FillNoData.cpp:(.text+0x6e7): undefined reference to >> `GDALGeneralCmdLineProcessor' >> gdal_FillNoData.cpp:(.text+0x7bc): undefined reference to >> > `CSLAddString' > >> gdal_FillNoData.cpp:(.text+0x7f2): undefined reference to >> `GDALDummyProgress' >> gdal_FillNoData.cpp:(.text+0x99d): undefined reference to >> `GDALDestroyDriverManager' >> gdal_FillNoData.cpp:(.text+0xa0e): undefined reference to >> `GDALDestroyDriverManager' >> gdal_FillNoData.cpp:(.text+0xa47): undefined reference to >> `GDALDestroyDriverManager' >> gdal_FillNoData.cpp:(.text+0xa6c): undefined ref>> >> gdal_FillNoData.cpp:(.text+0xa92): undefined reference to >> `CPLGetLastErrorMsg' >> gdal_FillNoData.cpp:(.text+0xa99): undefined reference to >> `CPLGetLastErrorNo' >> gdal_FillNoData.cpp:(.text+0xabc): undefined reference to >> `GDALDestroyDriverManager' >> gdal_FillNoData.cpp:(.text+0xad3): undefined reference to >> `GDALGetRasterXSize' >> gdal_FillNoData.cpp:(.text+0xae1): undefined reference to >> `GDALGetRasterYSize' >> gdal_FillNoData.cpp:(.text+0xb0f): undefined reference to >> `GDALGetRasterCount' >> gdal_FillNoData.cpp:(.text+0xb74): undefined reference to >> `GDALDestroyDriverManager' >> gdal_FillNoData.cpp:(.text+0xb92): undefined reference to >> `GDALGetRasterBand' >> gdal_FillNoData.cpp:(.text+0xba0): undefined reference to >> `GDALGetRasterDataType' >> gdal_FillNoData.cpp:(.text+0xbcf): undefined reference to >> `GDALGetMaskBand' >> gdal_FillNoData.cpp:(.text+0xbe7): undefined reference to >> `GDALOpenShared' >> gdal_FillNoData.cpp:(.text+0xc03): undefined reference to >> `GDALGetRasterBand' >> gdal_FillNoData.cpp:(.text+0xc0d): undefined reference to >> `CPLGetLasgdal_FillNoData.cpp:(.text+0xc37): undefined reference to >> `GDALDestroyDriverManager' >> gdal_FillNoData.cpp:(.text+0xc66): undefined reference to >> `GDALGetDriverByName' >> gdal_FillNoData.cpp:(.text+0xc74): undefined reference to >> `CPLGetLastErrorMsg' >> gdal_FillNoData.cpp:(.text+0xc7b): undefined reference to >> `CPLGetLastErrorNo' >> gdal_FillNoData.cpp:(.text+0xc9e): undefined reference to >> `GDALDestroyDriverManager' >> gdal_FillNoData.cpp:(.text+0xce0): undefined reference to `GDALCreate' >> gdal_FillNoData.cpp:(.text+0xcee): undefined reference to >> `CPLGetLastErrorMsg' >> gdal_FillNoData.cpp:(.text+0xcf5): undefined reference to >> `CPLGetLastErrorNo' >> gdal_FillNoData.cpp:(.text+0xd18): undefined reference to >> `GDALDestroyDriverManager' >> gdal_FillNoData.cpp:(.text+0xd49): undefined reference to >> `GDALGetRasterBand' >> gdal_FillNoData.cpp:(.text+0xd85): undefined reference to >> `GDALGetRasterNoDataValue' >> gdal_FillNoData.cpp:(.text+0xd94): undefined reference to >> `GDALSetRasterNoDataValue' >> gdal_FillNoData.cpp:(.text+0xdd3): undefined reference to >> `GDALFillNodata' >> gdal_FillNoData.cpp:(.text+0xdde): undefined referenc> gdal_FillNoData.cpp:(.text+0xe00): undefined reference to `GDALClose' >> gdal_FillNoData.cpp:(.text+0xe1a): undefined reference to >> `GDALTermProgress' >> collect2: ld returned 1 exit status >> >> >> >>>>> Brent Fraser <bfra...@geoanalytic.com> 03/18/09 11:40 PM >>> >>>>> >> Wesley, >> >> I had the same problem when dealing with DEMs over the last few >> > days. > >> I don't know enough about python to make it work, so I coded >> gdal_fillnodata in c++ (ish). See attached file. This is barely >> debugged, so it may need some fixes to work for you. >> >> Brent Fraser >> GeoAnalytic Inc. >> >> >> Wesley Roberts wrote: >> >>> Dear List, >>> >>> Yesterday I did an install of the latest svn gdal release (think it >>> > is > >> 1.7) to my local machine. I am interested in using the >> gdal_fillnodata.py application to fill some lines in my Landsat 7 ETM >> data. When I run the code >> >>> python gdal_fillnodata.py -md 400 >>> > /home/wroberts/wes2006/Projects/Evapotranspiration/Data/Landsat_NDVI/test.img > > /home/wroberts/wes2006/Projects/Evapotranspiration/Data/Landsat_NDVI/test.fill.img > >>> I get the following error >>> >>> gdal.FillNodata() not available. You are likely using "old gen" >>> bindings or an older version of the next gen bindings. >>> >>> I am not sure what this means, could somebody suggest a solution or >>> >> work around. I am currently trying r.fillnulls in Grass and that is >> taking a really long time. >> >>> Many thanks for your help and input, >>> Wesley >>> >>> Wesley Roberts MSc. >>> Researcher: Earth Observation (Ecosystems) >>> Natural Resources and the Environment >>> CSIR >>> Tel>>> - Chinese proverb >>> >>> >>> >> > > > -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support. _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev