avalentino / gsdview

Lightweight Geo-Spatial Data Viewer (GSDView) written in python and Qt. It uses the GDAL library for data access, it is modular and has a simple plug-in architecture.
GNU General Public License v2.0
25 stars 8 forks source link

CoordinateTransformation_TransformPoint: Wrong number of arguments #89

Closed PierrickKoch closed 10 years ago

PierrickKoch commented 10 years ago

Following is a bug report from the GUI with GDAL 1.10 (from https://github.com/OSGeo/gdal branch trunk)

Sat, 14 Sep 2013 16:35:21 +0200
--------------------------------------------------------------------------------
NotImplementedError: Wrong number of arguments for overloaded function 'CoordinateTransformation_TransformPoint'.
  Possible C/C++ prototypes are:
    TransformPoint(OSRCoordinateTransformationShadow *,double [3])
    TransformPoint(OSRCoordinateTransformationShadow *,double [3],double,double,double)

--------------------------------------------------------------------------------
Traceback:
  File "/home/pkoch/sandbox/gsdview/gsdview/plugins/worldmap/core.py", line 268, in onModelChanged
    self.setItemFootprint(item)
  File "/home/pkoch/sandbox/gsdview/gsdview/plugins/worldmap/core.py", line 231, in setItemFootprint
    footprint = item.footprint()
  File "/home/pkoch/sandbox/gsdview/gsdview/gdalbackend/modelitems.py", line 337, in footprint
    [0.5, self.RasterYSize - 0.5])
  File "/home/pkoch/sandbox/gsdview/gsdview/gdalbackend/gdalsupport.py", line 697, in imgToGeoGrid
    lon, lat = self.imgToGeoPoints(px, py)
  File "/home/pkoch/sandbox/gsdview/gsdview/gdalbackend/gdalsupport.py", line 675, in imgToGeoPoints
    xy[:, index] = self._srTransform.TransformPoint(x, y)[:2]
  File "/usr/local/lib/python2.7/dist-packages/GDAL-1.10.0-py2.7-linux-x86_64.egg/osgeo/osr.py", line 753, in TransformPoint
    return _osr.CoordinateTransformation_TransformPoint(self, *args)
--------------------------------------------------------------------------------
GSDView v. 0.7.0.dev (http://gsdview.sourceforge.net)
Python v. 2.7.3 (www.python.org)
Qt v. 4.8.1 (http://qt.nokia.com)
numpy v. 1.6.1 (http://www.scipy.org)
sip v. 4.13.2 (http://www.riverbankcomputing.co.uk/software/sip)
PyQt4 v. 4.9.1 (http://www.riverbankcomputing.co.uk/software/pyqt)
GNU/Linux v. Ubuntu 12.04 precise ()
architecture: 64bit ELF
platform: Linux-3.5.0-40-generic-x86_64-with-Ubuntu-12.04-preciseglibc 2.7
GNU/Linux: Ubuntu 12.04 precise
python_compiler: GCC 4.6.3
python_implementation: CPython
avalentino commented 10 years ago

Hi @pierriko, thank you for reporting. I will try to fix it ASAP.

PierrickKoch commented 10 years ago

Thanks! for the record, here is how I installed GDAL and its Python binding:

# clone GDAL git repository
git clone git://github.com/OSGeo/gdal.git && cd gdal
# or if you already got gdal git repo, just pull "trunk"
git checkout trunk && git pull --rebase git://github.com/OSGeo/gdal.git trunk
# install the latest lib in ~/devel
cd gdal && ./configure --prefix=$HOME/devel && make -j8 && make install
# install Python binding
cd swig/python && python setup.py install
avalentino commented 10 years ago

Sorry @pierriko, I'm not able to reproduce the issue on my machine. Can you please provide more details about how to reproduce the issue? The program crashes at startup or when you try to open a product? What kind of product?

PierrickKoch commented 10 years ago

It happens opening some specific GeoTiff: http://homepages.laas.fr/pkoch/pub/slowtry_orthomosaic_geo_rgb.1p.tif

This image size was intentionally reduce, but the bug is the same.

avalentino commented 10 years ago

@pierriko OK thanks, now I can reproduce it. I will work on it in next days.

avalentino commented 10 years ago

Hi @pierriko, it seems to me that it is an installation issue of the GDAL library. Looking at the terminal output I can find an error message claiming about the inability to find libproj4 that is installed instead.

ERROR 6: Unable to load PROJ.4 library (libproj.so), creation of
OGRCoordinateTransformation failed.
Traceback (most recent call last):
  File "/home/antonio/projects/gsdview/gsdview/plugins/worldmap/core.py", line 258, in onItemClicked
    self.setItemFootprint(item)
  File "/home/antonio/projects/gsdview/gsdview/plugins/worldmap/core.py", line 231, in setItemFootprint
    footprint = item.footprint()
  File "/home/antonio/projects/gsdview/gsdview/gdalbackend/modelitems.py", line 337, in footprint
    [0.5, self.RasterYSize - 0.5])
  File "/home/antonio/projects/gsdview/gsdview/gdalbackend/gdalsupport.py", line 701, in imgToGeoGrid
    lon, lat = self.imgToGeoPoints(px, py)
  File "/home/valentino/projects/gsdview/gsdview/gdalbackend/gdalsupport.py", line 679, in imgToGeoPoints
    xy[:, index] = self._srTransform.TransformPoint(x, y)[:2]
  File "/home/antonio/gdal/lib/python2.7/site-packages/GDAL-1.10.0-py2.7-linux-x86_64.egg/osgeo/osr.py", line 753, in TransformPoint
    return _osr.CoordinateTransformation_TransformPoint(self, *args)
NotImplementedError: Wrong number of arguments for overloaded function 'CoordinateTransformation_TransformPoint'.
  Possible C/C++ prototypes are:
    TransformPoint(OSRCoordinateTransformationShadow *,double [3])
    TransformPoint(OSRCoordinateTransformationShadow *,double [3],double,double,double)

I can reproduce the issue only when the libproj-dev package is not installed. In that case the libproj4 library is only available as /usr/lib/linproj.so.0 while the -dev package also provides a /usr/lib/libproj.so link.

In conclusion if you install libproj-dev or make a link named libproj.so in your lib search path you should be able to fix the issue.

PierrickKoch commented 10 years ago

Thanks, solved :-)