0

I'm trying to calculate a conditional in a line feature but I can't see were my sintax is wrong. Could you guys help me?

def Reclass(TIPO_PAV):
    if TIPO_PAV=='TERRA':
        return !shape.length@kilometers! /40*60
    if TIPO_PAV=='ASFALTO': 
        return  !shape.length@kilometers!
    else:
        return 0

enter image description here

3

You should specify the field within the function in the execute window. You can't just put the field in parenthesis.

def Reclass(field):
    if field =='TERRA':
        return !shape.length@kilometers! /40*60
    if field =='ASFALTO': 
        return !shape.length@kilometers!
    else:
        return 0

enter image description here

  • OK ..I dit it now but stil not working. – Flavio Felix Mar 9 '18 at 15:22
  • The error is point to line where are the expression !shape.length@kilometers! – Flavio Felix Mar 9 '18 at 18:12
  • 1
    Pass !shape! To def as well – FelixIP Mar 9 '18 at 18:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.