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?
Solved! Go to Solution.
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
Hi Akshay,
Try using the Add Geometry Attributes tool for this and use the Length property to get the length of the line:
http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/add-geometry-attributes.htm
Thanks Adrian Welsh for the response. I am looking for equation of the line and not the length
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
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.
Changing a segment into a straight line, a circular arc, or a Bézier curve—Help | ArcGIS for Desktop
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.
Thank you! Mr. Dan Patterson.