<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Reverse bearing calls in attribute table. in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/reverse-bearing-calls-in-attribute-table/m-p/42774#M3388</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I do have 10.1 so python parser would be ideal...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 04 Jan 2013 14:12:31 GMT</pubDate>
    <dc:creator>NoahHuntington</dc:creator>
    <dc:date>2013-01-04T14:12:31Z</dc:date>
    <item>
      <title>Reverse bearing calls in attribute table.</title>
      <link>https://community.esri.com/t5/python-questions/reverse-bearing-calls-in-attribute-table/m-p/42769#M3383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can anybody help with a field calculator expression which reverses the direction of a cogo direction field.&amp;nbsp; Where N 90 0 0 E becomes S 90 0 0 W?&amp;nbsp; Any help is greatly appreciated.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2013 12:58:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reverse-bearing-calls-in-attribute-table/m-p/42769#M3383</guid>
      <dc:creator>NoahHuntington</dc:creator>
      <dc:date>2013-01-04T12:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse bearing calls in attribute table.</title>
      <link>https://community.esri.com/t5/python-questions/reverse-bearing-calls-in-attribute-table/m-p/42770#M3384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try looking into attribute assistant, it's part of the GIS for local government.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2013 13:46:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reverse-bearing-calls-in-attribute-table/m-p/42770#M3384</guid>
      <dc:creator>JonPedder</dc:creator>
      <dc:date>2013-01-04T13:46:51Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse bearing calls in attribute table.</title>
      <link>https://community.esri.com/t5/python-questions/reverse-bearing-calls-in-attribute-table/m-p/42771#M3385</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Interesting problem- you want to reverse &lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;all&lt;/SPAN&gt;&lt;SPAN&gt; bearings and these values are all contained in one text field, correct?...in addition to the example you gave, you want to reverse, say, N 40 0 0 E&amp;nbsp; to&amp;nbsp; S 40 0 0 W&amp;nbsp; and (one more example) S 60 0 0 E&amp;nbsp; to&amp;nbsp; N 60 0 0 W ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If so, then you only need to change the beginning and ending characters, am I reading you correctly?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(N to S, S to N) for the beginning; (E to W, W to E) for the ending....pardon me, I'm thinking while writing, but the logic would be to change bearings NE to SW, NW to SE, SE to NW, and SW to NE, those 4 cases.&amp;nbsp; (the actual numeric vals stay the same)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you have 10.1 you can use the provided python parser to create an exp in the field calculator; otherwise you can still use the VB select case exp in the field calculator.&amp;nbsp; Or just use a py script (no field calculator) w/ an update cursor.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2013 13:53:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reverse-bearing-calls-in-attribute-table/m-p/42771#M3385</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-01-04T13:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse bearing calls in attribute table.</title>
      <link>https://community.esri.com/t5/python-questions/reverse-bearing-calls-in-attribute-table/m-p/42772#M3386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Interesting problem- you want to reverse &lt;SPAN style="text-decoration:underline;"&gt;all&lt;/SPAN&gt; bearings and these values are all contained in one text field, correct?...in addition to the example you gave, you want to reverse, say, N 40 0 0 E&amp;nbsp; to&amp;nbsp; S 40 0 0 W&amp;nbsp; and (one more example) S 60 0 0 E&amp;nbsp; to&amp;nbsp; N 60 0 0 W ?&lt;BR /&gt;&lt;BR /&gt;If so, then you only need to change the beginning and ending characters, am I reading you correctly?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Correct.&amp;nbsp; Any instance of SE needs to become NW and so on. I could change them individually but was hoping to to automate this process to take care of large records. Thanks for chiming in.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2013 13:59:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reverse-bearing-calls-in-attribute-table/m-p/42772#M3386</guid>
      <dc:creator>NoahHuntington</dc:creator>
      <dc:date>2013-01-04T13:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse bearing calls in attribute table.</title>
      <link>https://community.esri.com/t5/python-questions/reverse-bearing-calls-in-attribute-table/m-p/42773#M3387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;OK, good, I added to my last post...so which route do you prefer to take?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2013 14:04:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reverse-bearing-calls-in-attribute-table/m-p/42773#M3387</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-01-04T14:04:45Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse bearing calls in attribute table.</title>
      <link>https://community.esri.com/t5/python-questions/reverse-bearing-calls-in-attribute-table/m-p/42774#M3388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I do have 10.1 so python parser would be ideal...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2013 14:12:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reverse-bearing-calls-in-attribute-table/m-p/42774#M3388</guid>
      <dc:creator>NoahHuntington</dc:creator>
      <dc:date>2013-01-04T14:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse bearing calls in attribute table.</title>
      <link>https://community.esri.com/t5/python-questions/reverse-bearing-calls-in-attribute-table/m-p/42775#M3389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ah, good and by the way it also works at 10.0 (I was thinking of labeling), give me a minute will you?....what I'll do is test the a py function using a def statement for the field calculator applied to those 4 cases established above-- something similar to that shown here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Calculate Field examples&amp;nbsp; (the section on 'Using Code Blocks', see the 1st pic)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Resource Center » Professional Library » Data Management » Geographic data types » Tables » Calculating field values&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//005s0000002m000000"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//005s0000002m000000&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2013 14:20:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reverse-bearing-calls-in-attribute-table/m-p/42775#M3389</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-01-04T14:20:48Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse bearing calls in attribute table.</title>
      <link>https://community.esri.com/t5/python-questions/reverse-bearing-calls-in-attribute-table/m-p/42776#M3390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Take all the time you need.&amp;nbsp; Thanks for the help!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2013 14:52:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reverse-bearing-calls-in-attribute-table/m-p/42776#M3390</guid>
      <dc:creator>NoahHuntington</dc:creator>
      <dc:date>2013-01-04T14:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse bearing calls in attribute table.</title>
      <link>https://community.esri.com/t5/python-questions/reverse-bearing-calls-in-attribute-table/m-p/42777#M3391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="plain" name="code"&gt;def revBearing(bearStr):&amp;nbsp; orientation = bearStr[0:1] + bearStr[-1:]&amp;nbsp; if orientation == 'NE': &amp;nbsp; testStr = bearStr.replace('N','S') &amp;nbsp; testStr = testStr.replace('E','W')&amp;nbsp; elif orientation == 'NW': &amp;nbsp; testStr = bearStr.replace('N','S') &amp;nbsp; testStr = testStr.replace('W','E')&amp;nbsp; elif orientation == 'SE': &amp;nbsp; testStr = bearStr.replace('S','N') &amp;nbsp; testStr = testStr.replace('E','W')&amp;nbsp; elif orientation == 'SW': &amp;nbsp; testStr = bearStr.replace('S','N') &amp;nbsp; testStr = testStr.replace('W','E')&amp;nbsp; else: &amp;nbsp; # handle something unexpected here &amp;nbsp; testStr = ''&amp;nbsp; return testStr&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That should do it -- may be a shorter way, but the logic is clear...test this, copy/paste the def statement into the field calculator...follow the example as in the aforemention pic on the webhelp page...to call the function, enter on the code block bottom text box (replacing &amp;lt; your field &amp;gt; with the name of your txt field -- the function has been tested in IDLE, but I didn't go as far to test this in the field calculator, so let me know how it goes):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;revBearing(!&amp;lt; your field &amp;gt;!)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2013 14:53:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reverse-bearing-calls-in-attribute-table/m-p/42777#M3391</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-01-04T14:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse bearing calls in attribute table.</title>
      <link>https://community.esri.com/t5/python-questions/reverse-bearing-calls-in-attribute-table/m-p/42778#M3392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Like a charm! Thanks for the help!!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2013 15:08:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reverse-bearing-calls-in-attribute-table/m-p/42778#M3392</guid>
      <dc:creator>NoahHuntington</dc:creator>
      <dc:date>2013-01-04T15:08:22Z</dc:date>
    </item>
  </channel>
</rss>

