In the last few months I am experimenting with ArcGIS in order to create a synthesis of tools in model builder for my postgraduate thesis. The problem I am facing for a long time now is the following:
I have one (or more it doesn't matter) linear objects (that represent faults) and with the help of "create routes" and "make route event layer" tools I place points on it (representing epicenters of an earthquake). I want to achieve a relocation (or offsetting) of all these points vertically to the trend-line of the linear feature I create with the "smooth line" tool. The only thing I have managed till now is a relocation by changing a small script I found in a site (gis stackexchange).
def Shift_XY_Coordinates(shape, x, y):
value = distance
point = shape.getPart(0)
point.X = x + value
point.Y = y + value
return point
with the expression
Shift_XY_Coordinates(!shape!, !POINT_X!, !POINT_Y!)
I want to offset the points by 10 km. How am I supposed to add the correct distance every time when the angle of the linear feature class may be different every time? At the example I am using the trend line has an angle of 45 degrees and when I tried
def Shift_XY_Coordinates(shape, x, y):
value = 10000
point = shape.getPart(0)
point.X = math.sin(45)*value + x
point.Y = math.cos(45)*value + y
return point
it worked but only for this specific angle. Is there a way to relate the angle of the trendline with the angle that the user will input every time at the script? Or is there a probably easier way to achieve this relocation? Thank you very much and I appreciate any help. I also attach a picture of my problem.