I'm trying to calculate the direction the 'generate near table' function gives me into actual directions, N, NW etc. Azimuth would be a start too.
I tried this script in the field calculator but it doesn't run.
This was the original we tried:
if([Direction]>0,
if([Direction]<22.5,"W",
if([Direction]<67.5,"SW",
if([Direction]<112.5,"S",
if([Direction]<157.5,"SE",
if([Direction]<180,"E",""))))),
if([Direction]>-22.5,"W",
if([Direction]>-67.5,"NW",
if([Direction]>-112.5,"N",
if([Direction]>-157.5,"NE",
if([Direction]>-180,"E",""))))))
I tried it with and without "then output=
" and "Else, output =0
".
I'm using ArcGIS 10, have tried with with python and vb ticked.
Best Answer
Try this. Set Parser to VBScript and tick the Show Codeblock option. Add this to the Pre-Logic Script Code field.
Add this single line to the [fieldname] = field.
Note: I have not tried this in ArcMap. If it doesn't work try turning all instances of "ELSEIF" to "ELSE IF".