I have created a tool in Model Builder to plot telecoms data - the user clicks a point on the map, enters a radius and enters an azimuth. The model then creates the buffer and cuts a segment out of the buffer based on the azimuth angle.
In order to calculate the bearing of each line in the segment, I have added some code to the Field Calculator to ensure it takes into account there is 360 degrees in a circle...see below.
dim val If [Azimuth] < 60 Then val = 360 - (60-[Azimuth]) Else val = [Azimuth] - 60 End If
I want to publish this tool as a geoprocessing service to ArcGIS Portal, to then use as a widget within WAB.
I cannot publish the tool with the codeblock written in VB and therefore need to convert to Python, can anyone help me with the syntax please?
I'm using ArcMap 10.5.
Python I'm testing now but getting an error of invalid syntax in line 1...
def calc(!Bearing_1!): if !Azimuth! < 60 return 360 - (60 - !Azimuth!) else: return !Azimuth! - 60