AnsweredAssumed Answered

Arcpy.PointGeometry.pointFromAngleAndDistance help needed

Question asked by flspat on Mar 25, 2016
Latest reply on May 2, 2016 by bixb0012

Hi All,

 

I won't say projections and transformation and all the math involved in coordinate systems are my strong point but something seems off when I use this method to create points at specified angles/distances - especially at the 0, 90, 180, 270 angles.  It could just be my understanding of the math and potentially this method is not the correct tool for the job as they say.  Here's my simple test and what I'm seeing:

 

Create a point in a projected coordinate system (Montana State Plane: 102300) at the center (0,0). 

Use this method to create a new point with angle 0, distance 10,000 meters and the "PLANAR" option. 

 

My exception (which could be wildly wrong) would be to get the point (0,10000).  Since my angle is 0, i'm not expecting the X value to change --- at least when using the PLANAR option.  The result i get is (954.9342, 9961.7461) ... so over 10,000 meters I've deviated 1,000 meters in the X and came up 40 meters short in the Y.  Does this seem correct for the "PLANAR" option? 

 

I was expecting pretty basic Cartesian math here... but maybe not?  When I run the reverse method 'angleAndDistanceTo' using the two points, it DOES return 0 for angle and 10,000 for distance so it's at least being consistent in both directions.

 

However when I try any of the other options GEODESIC,GREAT_ELLIPTIC, LOXODROME, and PRESERVE_SHAPE I get the same point coordinates. Which sort of makes me think something is off with the function .... Shouldn't there be some differences with these options?

 

I get slightly different numbers if I choose a UTM zone rather than the MT SP system so the math appears to be using specifics of the coordinate system but again I wasn't expecting that for the "PLANAR" option.  The help on the methods don't really shed much light on it either: PointGeometry—Help | ArcGIS for Desktop

 

TEST CODE

 

ptg = arcpy.PointGeometry(arcpy.Point(0,0), arcpy.SpatialReference(102300))
ptg.firstPoint

ptg_1 = ptg.pointFromAngleAndDistance(0, 10000, "PLANAR")
ptg_1.firstPoint

ptg.angleAndDistanceTo(ptg_1, "PLANAR")

ptg_1 = ptg.pointFromAngleAndDistance(0, 10000, "GEODESIC")
ptg_1.firstPoint

ptg_1 = ptg.pointFromAngleAndDistance(0, 10000, "GREAT_ELLIPTIC")
ptg_1.firstPoint

ptg_1 = ptg.pointFromAngleAndDistance(0, 10000, "LOXODROME")
ptg_1.firstPoint

ptg_1 = ptg.pointFromAngleAndDistance(0, 10000, "PRESERVE_SHAPE")
ptg_1.firstPoint

 

RESULTS

<Point (0.0, 0.0, #, #)>

<Point (954.907914023, 9961.4713466, #, #)>

(0.0, 10000.000000000931)

<Point (954.907914023, 9961.4713466, #, #)>

<Point (954.907914023, 9961.4713466, #, #)>

<Point (954.907914023, 9961.4713466, #, #)>

<Point (954.907914023, 9961.4713466, #, #)>

 

The overall goal is to construct transects to a feature and even if the math is correct, the visual result is not what user expects which are exactly perpendicular lines thru the feature:

 

 

It's likely the math is correct and my understanding of the function is off so I need to simply write my own "planar" functions for this but that's not really obvious from the help. 

 

Thanks for any enlightenment you like to share.

Outcomes