2

I'm attempting to create quick code that simply assigns a gps coordinate to a certain station on the map. Here's my current code Pre-logic script code:

def update_nones(lat,bay_statio):
if bay_statio=="apalachicola0":
    return 29.733333
elif bay_statio == "apalachicola1":
    return 29.7583008       
   else:
 return lat

lat=

update_nones(!lat!,!bay_statio!)

For some reason I keep receiving an error in the geo-processing window. The code works with one condition but once I had the elif statement it refuses to compile.

Any ideas?

1
  • It is a pure Python problem, nothing to do with ArcMap
    – gene
    Oct 11, 2015 at 19:40

1 Answer 1

5

It seems like your indentation is not correct. Try this snippet:

def update_nones(lat,bay_statio):
  if bay_statio=="apalachicola0":
    return 29.733333
  elif bay_statio == "apalachicola1":
    return 29.7583008       
  else:
    return lat
2
  • That did the trick, I'm still a newb (just learning the ropes to speed up some map making) and I had no idea that indentation was so important!
    – Ferretron5
    Oct 11, 2015 at 23:32
  • 2
    If it works, mark answer as correct
    – FelixIP
    Oct 11, 2015 at 23:55

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