# Draw middle ordinate perpendicular to chord, out to curve, with arcpy

I've been assigned to find the radius of road curves. My boss found this article describing a pretty straightforward method of doing so:

1. find the start/end points of the curve;
2. create a chord;
3. create the middle ordinate (from chord midpoint, perpendicular line that goes up to the curve)
4. do a bit of math with the chord and ordinate lengths to find the radius.

Manually, this works very well. The downside is that I'm working with thousands of miles of road, so we want to build an automated tool to be able to quickly analyze our entire existing network, and also be able to check roads digitized in future.

I have adapted this script to find transition points where the curve begins/ends -- comparing line segments to see if the road direction is changing (e.g. is it still turning right, or has it started curving left instead). I therefore have chords for all the curves, but now I'm struggling with how to make middle ordinates. It needs to:

1. start at the midpoint of the chord
2. be perpendicular to the chord (I'm not positive how to do this yet, but found a script that will probably work and/or be adaptable)
3. be long enough to reach the road, but no longer (???)

So, long question short: how can I find the (approximate) distance between my chord midpoint and the road?

(Another StackExchange question describes working with the Near_analysis function which looks like it could work, but I currently have all of those chord midpoints just stored as a python list, not a feature class. I'd like to avoid generating a bunch of new features if possible.)

• The closely related answer at gis.stackexchange.com/a/37078/664 shows how to estimate the curvature at any point along a polyline. The radius is the reciprocal of the curvature. The calculation even tells you whether the road is bending right or left, so you don't need a separate algorithm for that. Because it fits smooth curves to the necessarily more jagged piecewise linear approximation you describe, it can be expected to give more accurate results--and it can even be adapted to report an estimate of its accuracy at each point. – whuber Sep 23 '13 at 18:01
• Hmm, nice (I should have been searching stackexchange for inflection!)... I will look at adapting that into a python script. – Erica Sep 24 '13 at 12:56

## 1 Answer

To find the distance between your chord mid-point and the line segment - you could use an in_memory feature class and do a near analysis- this will give you a distance from the midpoint x,y to the nearest point on the line. i.e:

``````pnt = arcpy.Point(x,y)
ptGeom = arcpy.PointGeometry(pnt)
arcpy.Near_analysis(ptGeom, "Oringial Line", "", "True", "True")
``````