I finally found out how to set the option properly. An other option must be
specified :
Rasterization.SetParameterString("mode", 'attribute')
Rasterization.SetParameterString("mode.attribute.field", field_name)
and it works =)
Marc
Le jeudi 12 janvier 2017 11:23:24 UTC+1, Marc Lang a écrit :
>
> Thanks for those explanations. I now remark that I did'nt find out how to
> use properly the Attribute burning mode, for both command line and python
> bindings. I used the following options :
>
> - Rasterization.SetParameterString("mode.attribute.field", 'num') for
> python bindings
> - mode.attribute.field 'num' in command line.
>
> But in the output it seems that it was the Binary mode with a default
> value of 255 that was used instead. I could'nt find out in the doc how to
> set properly this option. Any suggestions ?
>
> Regards,
>
> Marc
>
> Le mercredi 11 janvier 2017 18:15:08 UTC+1, Guillaume Pasero a écrit :
>>
>> The standalone OTB build uses its own GDAL version (2.1.0, even if you
>> don't call otbenv.profile) so the GDAL_DATA has to be set accordingly. Yes
>> I advise you to source otbenv.profile every time you use python binding,
>> otherwise GDAL will try to read data files on the system (somewhere in
>> /usr/share/...) that don't match its version.
>> Guillaume
>>
>> On 01/11/2017 05:58 PM, Marc Lang wrote:
>>
>> Yes it is standalone OTB 5.8 build.
>>
>> I lauched my IDE after I source "otbenv.profile" and it worked so that's
>> great =)
>>
>> But I don't understand why. Does it mean that when I don't use the
>> otbenv.profile environment or when I use it, otb python bindings try to use
>> different gdal versions ? Should I source "otbenv.profile" every time I
>> want to use otb python bindings ?
>>
>> Thank you,
>>
>> Marc
>>
>>
>> Le mercredi 11 janvier 2017 16:53:37 UTC+1, Guillaume Pasero a écrit :
>>>
>>> Hi,
>>>
>>> I think that command line and Python don't have the same environment.
>>> Maybe look at the GDAL_DATA variable.
>>>
>>> Is it a standalone OTB 5.8 build ?
>>>
>>> Regards,
>>>
>>> Guillaume
>>>
>>> On 01/11/2017 04:47 PM, Marc Lang wrote:
>>>
>>> Hi everyone,
>>>
>>> i'm trying to use the rasterization application with python bidings. In
>>> command line I did :
>>>
>>> otbcli_Rasterization -in 'myshape.shp' -out 'myrst.tif' -im
>>> 'myimref.tif' -mode.attribute.field 'num'
>>>
>>> and it worked well. But with python :
>>>
>>> Rasterization =
>>> otbApplication.Registry.CreateApplication("Rasterization")
>>>
>>> # The following lines set all the application parameters:
>>>
>>> Rasterization.SetParameterString("in", 'myshape.shp')
>>>
>>> Rasterization.SetParameterString("out", 'myrst.tif')
>>>
>>> Rasterization.SetParameterString("im", 'myimref.tif')
>>>
>>> Rasterization.SetParameterString("mode.attribute.field", 'num')
>>>
>>> Rasterization.ExecuteAndWriteOutput()
>>>
>>> I've got this error message : ERROR 1: No PROJ.4 translation for
>>> destination SRS, coordinate transformation initialization has failed.
>>>
>>> Apparently it's an error message relative to GDAL. Why is this error in
>>> python and not in command line ? Any suggestions to fix it ?
>>>
>>> I'm working on ubuntu 14.04, OTB 5.8.0 and GDAL 1.11.2 if it can help.
>>>
>>> Thank you,
>>>
>>> Marc
>>> --
>>> --
>>> 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.
>>>
>>>
>>> --
>>> <http://www.c-s.fr> *Guillaume PASERO*
>>> Responsable technique
>>> *Business Unit ESPACE & GeoInformation - Département Payload Data &
>>> Applications*
>>>
>>> *CS Systèmes d'Information*
>>> Parc de la Grande Plaine - 5, Rue Brindejonc des Moulinais - BP 15872
>>> 31506 Toulouse Cedex 05 - FRANCE
>>> +33 561 17 64 21 - [email protected]
>>>
>> --
>> --
>> 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.
>>
>>
>> --
>> <http://www.c-s.fr> *Guillaume PASERO*
>> Responsable technique
>> *Business Unit ESPACE & GeoInformation - Département Payload Data &
>> Applications*
>>
>> *CS Systèmes d'Information*
>> Parc de la Grande Plaine - 5, Rue Brindejonc des Moulinais - BP 15872
>> 31506 Toulouse Cedex 05 - FRANCE
>> +33 561 17 64 21 - [email protected]
>>
>
--
--
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.