Greetings folks,
Looking to be able to return the bearing of the side of a polygon based on a interaction.
I have a carto points feature class that I want to populate its F_ANGLE field with the bearing of the side in which intersects with a polygon. We use that bearing to change the symbology rotation. Any help would be great.
The image below shows a polygon and a point with symblogy interacting. I'd like to get the bearing of that intersection

I have got this working for an intersection of a line feature but not a polygon (image below).

Code for the intersection of lines is below, replacing the feature with a polygon does not work. Looking for someone with a bit more coding knowledge for some help
var LinesFC = Intersects(FeatureSetByName($datastore, "Lines", ['objectid', ''], false), $feature)
if (Count(LinesFC) > 0) {
var line = first(LinesFC)
var geom = Geometry(line)
var pt0 = geom.paths[0][0]
var brg = Bearing(pt0, Geometry($feature))
if (brg > 90 && brg <= 360) {
return (450 - brg)
}
return (90 - brg)
}
return null
Thanks in advanced.
-JS