# arcpy Geometry pointFromAngleAndDistance method

In my workflow I decided to use pointFromAngleAndDistance method and was surprised by output. Script below:

``````import arcpy
import prettytable
from prettytable import PrettyTable
maxDistance = 100.0
SR = arcpy.SpatialReference(2193)
pS = arcpy.Point(1750485,5915301)
pG = arcpy.PointGeometry(pS,SR)

x = PrettyTable()
x.field_names =  ['Method','Length,m']
x.align = "r"
x.float_format = '.4'
for method in 'PLANAR','GEODESIC','GREAT_ELLIPTIC','LOXODROME','PRESERVE_SHAPE':
pE = pG.pointFromAngleAndDistance (45.0, maxDistance,method).firstPoint
pLine = arcpy.Polyline(arcpy.Array([pS,pE]),SR)
print x
``````

prints:

when I expected to see 100.0 m for 'PLANAR' method at least, because:

PLANAR —Planar measurements use 2D Cartesian mathematics to calculate lengths and areas. This option is only available when measuring in a projected coordinate system, and the 2D plane of that coordinate system will be used as the basis for the measurements.

If I apply 2D Cartesian mathematics:

``````import arcpy
maxDistance = 100.0
SR = arcpy.SpatialReference(2193)
pS = arcpy.Point(1750485.0,5915301.0)
pE = arcpy.Point(pS.X+dX,pS.Y+dY)
pLine = arcpy.Polyline(arcpy.Array([pS,pE]),SR)
print pLine.length
``````

output IS 100.0 m:

I suspect the issue somehow related to NZGD_2000_New_Zealand_Transverse_Mercator projection in use. Where in documentation I can find more details of what is quietly happening behind the scene?

Heads up: I am not accepting arguments '..this is less than fraction of a percent'.

If I use your code, but tweak it to

1. Remove `prettytable`
2. Specify the XY resolution of the SpatialReference
3. Remove the unimplemented 'PRESERVE_SHAPE'

it looks like this:

``````import arcpy
maxDistance = 100.0

for units in [None, 10, 100, 1000, 10000, 100000]:

sr = arcpy.SpatialReference(2193)
parts = sr.falseOriginAndUnits.split(' ')
if units:
sr.setFalseOriginAndUnits(float(parts[0]),float(parts[1]),units)
print("\n=== falseOriginAndUnits = {:s}".format(sr.falseOriginAndUnits))

pStart = arcpy.Point(1750485,5915301)
pGeom  = arcpy.PointGeometry(pStart,sr)

for method in ['PLANAR','GEODESIC','GREAT_ELLIPTIC','LOXODROME']: #,'PRESERVE_SHAPE']:
pEnd = pGeom.pointFromAngleAndDistance (45.0, maxDistance,method).firstPoint
pLine = arcpy.Polyline(arcpy.Array([pStart,pEnd]),sr)
print("{:16s} {:15.6f} {:15.6f} {:10.4f}".format(
method,pLine.lastPoint.X,pLine.lastPoint.Y,pLine.length))
``````

Using ArcPy from ArcGIS Pro 3.0.3, I get this for output:

``````=== falseOriginAndUnits = -4020900 1900 10000
PLANAR            1750555.710678  5915371.710678   100.0000
GEODESIC          1750556.942457  5915370.439653    99.9879
GREAT_ELLIPTIC    1750556.942458  5915370.439652    99.9879
LOXODROME         1750556.942746  5915370.439354    99.9879

=== falseOriginAndUnits = -4020900 1900 10
PLANAR            1750555.710678  5915371.710678   100.0000
GEODESIC          1750556.942457  5915370.439653    99.9879
GREAT_ELLIPTIC    1750556.942458  5915370.439652    99.9879
LOXODROME         1750556.942746  5915370.439354    99.9879

=== falseOriginAndUnits = -4020900 1900 100
PLANAR            1750555.710678  5915371.710678   100.0000
GEODESIC          1750556.942457  5915370.439653    99.9879
GREAT_ELLIPTIC    1750556.942458  5915370.439652    99.9879
LOXODROME         1750556.942746  5915370.439354    99.9879

=== falseOriginAndUnits = -4020900 1900 1000
PLANAR            1750555.710678  5915371.710678   100.0000
GEODESIC          1750556.942457  5915370.439653    99.9879
GREAT_ELLIPTIC    1750556.942458  5915370.439652    99.9879
LOXODROME         1750556.942746  5915370.439354    99.9879

=== falseOriginAndUnits = -4020900 1900 10000
PLANAR            1750555.710678  5915371.710678   100.0000
GEODESIC          1750556.942457  5915370.439653    99.9879
GREAT_ELLIPTIC    1750556.942458  5915370.439652    99.9879
LOXODROME         1750556.942746  5915370.439354    99.9879

=== falseOriginAndUnits = -4020900 1900 100000
PLANAR            1750555.710678  5915371.710678   100.0000
GEODESIC          1750556.942457  5915370.439653    99.9879
GREAT_ELLIPTIC    1750556.942458  5915370.439652    99.9879
LOXODROME         1750556.942746  5915370.439354    99.9879
``````

But, since your code was Python 2.7 (which I haven't used in over a year), I also ran it using my (mostly unused) 10.8.2 install, and got this:

``````=== falseOriginAndUnits = -4020900 1900 10000
PLANAR            1750556.942457  5915370.439653    99.9879
GEODESIC          1750556.942457  5915370.439653    99.9879
GREAT_ELLIPTIC    1750556.942458  5915370.439652    99.9879
LOXODROME         1750556.942746  5915370.439354    99.9879

=== falseOriginAndUnits = -4020900 1900 10
PLANAR            1750556.942457  5915370.439653    99.9879
GEODESIC          1750556.942457  5915370.439653    99.9879
GREAT_ELLIPTIC    1750556.942458  5915370.439652    99.9879
LOXODROME         1750556.942746  5915370.439354    99.9879

=== falseOriginAndUnits = -4020900 1900 100
PLANAR            1750556.942457  5915370.439653    99.9879
GEODESIC          1750556.942457  5915370.439653    99.9879
GREAT_ELLIPTIC    1750556.942458  5915370.439652    99.9879
LOXODROME         1750556.942746  5915370.439354    99.9879

=== falseOriginAndUnits = -4020900 1900 1000
PLANAR            1750556.942457  5915370.439653    99.9879
GEODESIC          1750556.942457  5915370.439653    99.9879
GREAT_ELLIPTIC    1750556.942458  5915370.439652    99.9879
LOXODROME         1750556.942746  5915370.439354    99.9879

=== falseOriginAndUnits = -4020900 1900 10000
PLANAR            1750556.942457  5915370.439653    99.9879
GEODESIC          1750556.942457  5915370.439653    99.9879
GREAT_ELLIPTIC    1750556.942458  5915370.439652    99.9879
LOXODROME         1750556.942746  5915370.439354    99.9879

=== falseOriginAndUnits = -4020900 1900 100000
PLANAR            1750556.942457  5915370.439653    99.9879
GEODESIC          1750556.942457  5915370.439653    99.9879
GREAT_ELLIPTIC    1750556.942458  5915370.439652    99.9879
LOXODROME         1750556.942746  5915370.439354    99.9879
``````

Unfortunately, I have no explanation as to why the coordinates are not truncated to the specified precision, or why the PLANAR values are correct in Pro 3.0.3, but incorrect in ArcMap 10.8.2 (64-bit and 32-bit). All I can do is suggest you move on to Pro (and Python 3).

• I appreciate your time and will take your advice because I don't have a choice. Unfortunately few monshs of experience with Pro scream: "Don't go there!". I have a large list of mildly speaking unpleasant surprises. My 'favorite' so far: order(!) of 2 paramaters in layer.setSelectionSet() is reverse in Pro. Looks like nothing, unless it is used in a family of now 'old' scripts and wrong order of parameters drives application into coma. Commented Oct 13, 2023 at 3:16
• Vince, regarding the why, the answer is related to BUG-000095821 for ArcGIS for Desktop. It was a defect logged back in ArcGIS Desktop 10.4, but Esri never addressed it in Desktop/ArcMap and finally fixed it in Pro at 2.8. Commented Dec 31, 2023 at 19:52