Did you try SetParameterStringList?

Victor Poughon
________________________________
De : [email protected] [[email protected]] de la part de Efi 
Konstantinidou [[email protected]]
Envoyé : mardi 4 décembre 2018 17:04
À : [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]
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