How to get equation of lines drawn in shapefiles?

2783
6
Jump to solution
05-22-2016 09:47 PM
AkshayJajoo
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?

0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
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

View solution in original post

6 Replies
AdrianWelsh
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:

http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/add-geometry-attributes.htm

AkshayJajoo
New Contributor

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

0 Kudos
DanPatterson_Retired
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

View solution in original post

curtvprice
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.

Changing a segment into a straight line, a circular arc, or a Bézier curve—Help | ArcGIS for Desktop

0 Kudos
DanPatterson_Retired
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.

AkshayJajoo
New Contributor

Thank you! Mr. Dan Patterson​.

0 Kudos