Wednesday, 7 September 2016

arcpy - Creating line of varying distance from origin point using Python in ArcGIS Desktop?


I'm trying to create a line feature from a single point, using a set distance and angle using ArcGIS and Python (ArcPy).


I have a point at these coordinates: X = 400460.99, Y = 135836.76



From this point, I want to create a 800 Meter long line at a 15 degree angle from that point.


I do not know what the resulting endpoint will be.


My data are projected in Maryland State Plane South - Meters.



Answer



The endpoint is displaced from the origin by 800 meters, of course. The displacement in the direction of the x-coordinate is proportional to the sine of the angle (east of north) and the displacement in the direction of the y-coordinate is proportional to the cosine of the angle.


Thus, from sin(15 degrees) = sin(0.261799) = 0.258819 and cos(15 degrees) = 0.965926 we obtain


x-displacement = 800 sin(15 degrees) = 800 * 0.258819 = 207.055 

y-displacement = 800 cos(15 degrees) = 800* 0.965926 = 772.741.


Therefore the endpoint coordinates are (400460.99 + 207.055, 135836.76 + 772.741) = (400668.05, 136609.49).


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...