Select to view content in your preferred language

How to get equation of lines drawn in shapefiles?

3655
6
Jump to solution
05-22-2016 09:47 PM
AkshayJajoo
Deactivated User

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 Emeritus

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 Honored 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
Deactivated User

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

0 Kudos
DanPatterson_Retired
MVP Emeritus

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

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 Emeritus

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
Deactivated User

Thank you! Mr. Dan Patterson​.

0 Kudos