3

I have a field that is in degree minutes seconds, populated from ET Geowizards COGO Inverse tool. It populates the values as 90-12-28.15 where 90 is the degree, 12 is the minutes and 28.15 is the seconds.

I need to use this field to label on a map. The format of the label is calling for the degree minutes seconds characters (i.e. 90° 12' 28.15") so I want to add a new field and use VB/Python to field calculate these characters in and remove the dashes.

1 Answer 1

6

The following Python field calculation script should work for you (tested in ArcMap 10.0):

Your expression should be:

calc(!YOUR_FIELD_NAME_HERE!)

And your code block should be:

def calc(val):
    val = val.split('-')
    return u'%s\u00B0 %s\u2032 %s\u2033' % tuple(val)

The \uXXXX characters are special unicode characters for °, ′, and ″ (thanks to Mike Toews)

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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