This error message is really bad sorry... There's also no example of 
SetParameterStringList in the cookbook so it's entirely our fault.

What happens is that when calling SetParameterStringList on a ListView, the 
application actually checks that the field exists in the shapefile. So you can 
get an error if the field doesn't exist.

But that's not why you have this error. In your case I think you need to do:

VectorClassifier.SetParameterStringList("feat", ["area", "perimeter", 
"complexity", "_mean", "_std", "pmr"])

or maybe

VectorClassifier.SetParameterStringList("feat", "area perimeter complexity 
_mean _std pmr")

I'm not sure which one. Let me know if it works.

Victor Poughon
________________________________
De : [email protected] [[email protected]] de la part de Efi 
Konstantinidou [[email protected]]
Envoyé : mercredi 5 décembre 2018 10:47
À : [email protected]
Objet : Re: [otb-users] vector classification, specifying parameters

Hi Victor,

I added 'setParameterStringList' to the code and get the following error:
VectorClassifier.SetParameterStringList("feat", "area", "perimeter", 
"complexity", "_mean", "_std", "pmr")
TypeError: SetParameterStringList() takes at most 4 arguments (8 given)

when removing the commas the following error appears:
'VectorClassifier.SetParameterStringList("feat", "area" "perimeter" 
"complexity" "_mean" "_std" "pmr")'

ERROR: ListViewParameter(00000000010C6F80): Value a not found in the list of 
choices: .


On Tue, Dec 4, 2018 at 6:18 PM Efi Konstantinidou 
<[email protected]<mailto:[email protected]>> wrote:
No, will try it (but tomorrow cuz I'm leaving the office soon) and let you know.
Thanks a lot!
E.

On Tue, Dec 4, 2018 at 6:11 PM Poughon Victor 
<[email protected]<mailto:[email protected]>> wrote:
Did you try SetParameterStringList?

Victor Poughon
________________________________
De : [email protected]<mailto:[email protected]> 
[[email protected]<mailto:[email protected]>] de la part de 
Efi Konstantinidou [[email protected]<mailto:[email protected]>]
Envoyé : mardi 4 décembre 2018 17:04
À : [email protected]<mailto:[email protected]>
Objet : Re: [otb-users] vector classification, specifying parameters

Hello Victor,
thanks for replying.
It does run form the command line. But I can't figure out the correct syntax 
for python. When the "feat" line is omitted in python, it does run but all 
polygons are classified in one class, which is wrong... In the command line I 
also specify all the attribute table columns to be used, as a 'list', like:

- feat area perimeter complexity etc...

And I haven't found any sample code that includes more than one features. Do 
you have any idea where to look for an answer? Also posted a question on GIS 
stack exchange with no results yet..

Regards,
E


- feat area perimeter complexity etc..

jhm



On Tue, Dec 4, 2018 at 5:09 PM Poughon Victor 
<[email protected]<mailto:[email protected]>> wrote:
Hi Efi

What are the field names in your shapefile? Are you sure it contains "area"? 
You can see it in QGIS (right click -> "Open attributes table" I think).

Another debug thing you can try is calling from the command line (with 
otbcli_VectorClassifier...) to see if you get the same error.

Best,

Victor Poughon
________________________________
De : [email protected]<mailto:[email protected]> 
[[email protected]<mailto:[email protected]>] de la part de 
Efi [[email protected]<mailto:[email protected]>]
Envoyé : mardi 4 décembre 2018 14:39
À : otb-users
Objet : [otb-users] vector classification, specifying parameters

Hello,

I am trying to classify a vector layer with otb and python. In Monteverdi all 
works fine. I think there must be a mistake in the code when defining the 
'cfield' and/ or the 'feat' parameters. Here is the code (also attached as .py 
file):

import otbApplication
VectorClassifier = otbApplication.Registry.CreateApplication("VectorClassifier")
VectorClassifier.SetParameterString("in", "zonals_22.shp")
VectorClassifier.SetParameterString("model", "model.txt")
#VectorClassifier.SetParameterString("cfield", "class")
#VectorClassifier.SetParameterString("feat", "area", "perimeter", "complexity", 
"_mean", "_std", "pmr")
VectorClassifier.SetParameterString("out", "out4.shp")
VectorClassifier.ExecuteAndWriteOutput()

Output is: itk::ERROR: ListViewParameter(0000000001023A20): Cannot find area
Any suggestions?
E

--
--
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html

You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to 
[email protected]<mailto:[email protected]>
To unsubscribe from this group, send email to
[email protected]<mailto:otb-users%[email protected]>
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
---
You received this message because you are subscribed to the Google Groups 
"otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.

--
--
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html

You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to 
[email protected]<mailto:[email protected]>
To unsubscribe from this group, send email to
[email protected]<mailto:otb-users%[email protected]>
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
---
You received this message because you are subscribed to the Google Groups 
"otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.

--
--
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html

You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to 
[email protected]<mailto:[email protected]>
To unsubscribe from this group, send email to
[email protected]<mailto:otb-users%[email protected]>
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
---
You received this message because you are subscribed to the Google Groups 
"otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.

--
--
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html

You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to 
[email protected]<mailto:[email protected]>
To unsubscribe from this group, send email to
[email protected]<mailto:otb-users%[email protected]>
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
---
You received this message because you are subscribed to the Google Groups 
"otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.

--
--
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html

You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
---
You received this message because you are subscribed to the Google Groups 
"otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.

-- 
-- 
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html

You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to