Post

1 follower Follow
1
Avatar

Clip algorithm failing and receiving C++ signature error

We have this question from one of our users on YouTube:

Hello, I used your style for clipping a raster, but I got error evertime.

My code is this:

from pci.clip import * 
fili = r"C:\Users\Mustafa\Desktop\Tabuk\img\4a.img" 
dbic = [1,2,3,4,5] 
filo = r"C:\Users\Mustafa\Desktop\Tabuk\test\clipped_4a.img" 
ftype = "IMG" 
clipmeth = "LAYERVEC" 
clipfil = r"C:\Users\Mustafa\Desktop\Tabuk\Shapefiles\Image Cuts\4a.shp" 
cliplay = 1 
laybnds = "SHAPES" 

clip ( fili, dbic, [], "", filo, ftype, "", clipmeth, clipfil, cliplay, laybnds, "", "", "", "", [], "", "") 

I got this error:

Traceback (most recent call last): File "<string>", line 16, in <module> Boost.Python.ArgumentError: Python argument types in pci.clip.clip(str, list, list, str, str, str, str, str, str, int, str, str, str, str, str, list, str, str) did not match C++ signature: clip(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > fili=u'', class boost::python::list {lvalue} dbic=[], class boost::python::list {lvalue} dbsl=[], class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > sltype=u'', class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > filo=u'', class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > ftype=u'', class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > foptions=u'', class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > clipmeth=u'', class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > clipfil=u'', class boost::python::list {lvalue} cliplay=[], class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > laybnds=u'', class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > coordtyp=u'', class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > clipul=u'', class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > cliplr=u'', class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > clipwh=u'', class boost::python::list {lvalue} initvalu=[], class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > setnodat=u'', class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > oclipbdy=u'')

What could be the reason?

PCI Geomatics Answered

Please sign in to leave a comment.

1 comment

1
Avatar

The reason for this error message is that one of the parameters for CLIP is of the wrong type. In this case, cliplay need to be a list instead of an integer. Change the cliplay variable to cliplay = [1].

The C++ signature lists the type of input that is required for each parameter. If you look for the cliplay parameter, you will notice that the C++ signature specifies it as a list- class boost::python::list {lvalue} cliplay=[]

PCI Geomatics 1 vote