Arcade function to convert direction in DMS to Decimal degrees

6360
14
01-06-2021 03:14 PM
Status: Implemented
Labels (1)
IreneHwang
New Contributor II

I have data where direction for the line is in DMS north azimuth.

To convert this data to decimal degrees, you need to strip off the degree, minutes seconds characters and then convert it to decimal degrees.

It will be a time saver if arcade had a function that could strip off the characters and convert to decimal degrees. This function will be very useful when converting data to load into a parcel fabric.

The current label expression shipped with COGO enabled lines converts decimal degrees to DMS north azimuth. What I am looking for is the reverse function.

14 Comments
MehdiPira1

@RichardShepherd 

Awesome! Thanks.

KoryKramer
Status changed to: Implemented

Implemented in ArcGIS Pro 2.8.

See Ideas in ArcGIS Pro 2.8 and (1:17) in the video.

DarylHochhalter

I was recently using this arcade function and ran into an issue (possible bug) between SQL enterprise geodatabase and a file geodatabase. I was converting DMS to Degrees and likely the other way around too. The script below worked in the file geodatabase but not in the enterprise geodatabase where it gave the error "expecting a mutable array".

Function DMS2DD(theTextAngle){
return ConvertDirection(theTextAngle,
{'angleType':'dms','directionType':'north'},{'outputType':'value','angleType':'degrees','directionType':'north'})
}
-DMS2DD($feature.TEXTANGLE)

After some research looking at the tables in SQL we decided that maybe it wasn't finding the recently added TEXTANGLE field. We compressed the SQL geodatabase and the above Arcade expression then worked in ArcGIS Pro Field Calculator.

Robert_Houston

Hi @DarylHochhalter,

Its possible that rather unhelpful error message should actually indicate "Invalid Argument" for ConvertDirections first argument, we'll look to replace that with a more helpful message!

Can $feature.TEXTANGLE ever be null? If so the call to convert direction would fail with the unhelpful message. Checking the type of theTextAngle param in DMS2DD is text might also help narrow down the problem.

Thanks for getting in touch with the issue!