# How to get equation of lines drawn in shapefiles?

2783
6
Jump to solution
05-22-2016 09:47 PM New Contributor

I have a shapefile for centerlines for streets of a city. The attribute table only contains start and end point coordinates for a line. Also some of the lines are curved. Is there any way to get equation of these lines?

Tags (4)
1 Solution

Accepted Solutions by MVP Esteemed Contributor

The curve is represented as a series of points which have the noted start and end coordinates.  You can get the line segment equation from these point pairs via normal calculations.  If you are looking for the equation of a curved segment, you have to use curve fitting equations outside of arcmap

6 Replies by MVP Notable Contributor

Hi Akshay,

Try using the Add Geometry Attributes tool for this and use the Length property to get the length of the line: New Contributor

Thanks Adrian Welsh for the response. I am looking for equation of the line and not the length by MVP Esteemed Contributor

The curve is represented as a series of points which have the noted start and end coordinates.  You can get the line segment equation from these point pairs via normal calculations.  If you are looking for the equation of a curved segment, you have to use curve fitting equations outside of arcmap by MVP Esteemed Contributor

It should be noted that lines can be edited as bezier curves in the geodatabase (not shapefiles). Though I don't think you can get at them without ArcObjects. by MVP Esteemed Contributor

Since you already have numpy installed and scipy if using 10.4 or pro, you can use

FeatureClassToNumPyArray with the explode points option, this will give you your points, then

numpy.polyfit — NumPy v1.10 Manual

scipy.optimize.curve_fit — SciPy v0.17.0 Reference Guide

And both have other curve fitting routintes, I have used some in the past in fitting circular curves to road network data.  Of course any type of curve fitting algorithm can be used once you have the x,y (z) coordinates. New Contributor

Thank you! Mr. Dan Patterson​. 