<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Calculating &amp;quot;best fit&amp;quot; line feature based on three height values    in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451063#M35356</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Then it could get real ugly, especially if the end points are at different elevations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://electricalengineerresources.com/2018/02/16/sample-calculation-of-sag-and-tension-in-transmission-line-uneven-elevation/" title="https://electricalengineerresources.com/2018/02/16/sample-calculation-of-sag-and-tension-in-transmission-line-uneven-elevation/"&gt;https://electricalengineerresources.com/2018/02/16/sample-calculation-of-sag-and-tension-in-transmission-line-uneven-ele…&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 16 Jun 2020 15:03:46 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2020-06-16T15:03:46Z</dc:date>
    <item>
      <title>Calculating "best fit" line feature based on three height values</title>
      <link>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451057#M35350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have line features representing overhead power lines, and for these power lines, I have height attribute values at three different locations: the start of the line, the end of the line and (using a distance attribute from start) the point of maximal sag of the line between start and end points. I do not want to create straight lines between start point, sag point and end point but a curved line of best fit between the three points. Note that the "sag" point is not always midway between the start and end point. I need to do this&amp;nbsp;in a python program as I have to calculate this for a large volume of lines, so the editing "arc" tool is not really something I can use.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I looked into trying to fit an ellipsoid between the points but that&amp;nbsp;is&amp;nbsp;no good as this would mean I have one ellipsoid between start point and sag point and another &lt;SPAN&gt;ellipsoid&amp;nbsp;&lt;/SPAN&gt;between sag point and end point. I need a single curve that fits all three points. I tried the spline tool, which creates a raster surface from points (which means I can perhaps get back from raster to more points), but 3 points is not enough to create a raster surface.&amp;nbsp;I also tried non spatial tools such as scipy interpolate (fitting a spline between sets of np.array values), but here also, I only have 3 points which is not sufficient to do the interpolation and create the "spline" line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone knows how to create a curve of best fit between three point locations? In my case these points are z (height) values so either a curved "best fit" line is calculated directly or intermediate points are calculated from which I&amp;nbsp; create&amp;nbsp;a new line feature. However, in that case I also would have to find the X and Y coordinates&amp;nbsp;of the&amp;nbsp;newly created (intermediate) z height values.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Difficult problem, I know, I am just wondering if someone has worked this out, or can help me in any way.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks very much.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hugo&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jun 2020 02:31:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451057#M35350</guid>
      <dc:creator>HugoBouckaert1</dc:creator>
      <dc:date>2020-06-05T02:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating "best fit" line feature based on three height values</title>
      <link>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451058#M35351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you’ve got three points couldn’t you fit a polynomial equation to the three points (x = 0,1,2; y = first point, sag point, last point)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i think that could give you the equation at least for the one Z axis I think?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Jun 2020 23:34:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451058#M35351</guid>
      <dc:creator>CodyScott</dc:creator>
      <dc:date>2020-06-06T23:34:23Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating "best fit" line feature based on three height values</title>
      <link>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451059#M35352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is effectively a "circle through three points".&amp;nbsp; Either the circle solution or a "best-fit" solution.&lt;/P&gt;&lt;P&gt;Assuming that the 3 points are on the same line, you can convert the data so that the x-variable is distance and the y-variable is your z.&lt;/P&gt;&lt;P&gt;Your distances would be 0 (ie the start point), distance to sag point, distance to end point.&lt;/P&gt;&lt;P&gt;Your z values become y.&lt;/P&gt;&lt;P&gt;Solve for the equation and generate other points as needed.&lt;/P&gt;&lt;P&gt;The equation would be degenerate if the line was completely straight.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assumptions:&lt;/P&gt;&lt;P&gt;This would work best if the sag point were in the middle of the span.&lt;/P&gt;&lt;P&gt;The length of cable relative to the distance between end points should be "uniform" so that the cable behaves in a similar fashion along its total length. (sloppy install with over or under tension will result in different deflections per unit length)&lt;/P&gt;&lt;P&gt;If there is significant elevation differences between the start and end points, the location of the sag point may shift significantly to the lower elevation end and the circle assumption would be void.&lt;/P&gt;&lt;P&gt;In those cases, you would have to consider a best-fit circle or ellipse through the points rather than a circle itself.&lt;/P&gt;&lt;P&gt;Best fit ellipses could be used, but "usually" at least 5 points are needed but code exists to handle situations like yours, but the effort is large.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is little point in working on this with 3 dimensions given that the span should form a straight line with the sag point somewhere along the line.&amp;nbsp; Translation and rotation to and from the initial coordinate system is covered by standard affine equations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Final note.&amp;nbsp; Before you begin on this venture, it would be useful to examine some of your transformed data to get an initial estimate of sag location and value relative to span length and span elevation difference.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Jun 2020 02:46:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451059#M35352</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-06-07T02:46:34Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating "best fit" line feature based on three height values  </title>
      <link>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451060#M35353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;out of curiosity do you know the XYZ for each of the Start, End and Sag points?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2020 15:47:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451060#M35353</guid>
      <dc:creator>CodyScott</dc:creator>
      <dc:date>2020-06-15T15:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating "best fit" line feature based on three height values</title>
      <link>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451061#M35354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes I do, but it still means there are only 3 locations to work from in 3D space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Get Outlook for iOS&amp;lt;https://aka.ms/o0ukef&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2020 23:35:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451061#M35354</guid>
      <dc:creator>HugoBouckaert1</dc:creator>
      <dc:date>2020-06-15T23:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating "best fit" line feature based on three height values</title>
      <link>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451062#M35355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you trying to model a catenary curve&amp;nbsp;between your points then?&amp;nbsp;From my understanding that's the curve that would match a cable hanging problem like you've described.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I might have a solution but since&amp;nbsp;the scale of the curve is dependent on the horizontal/vertical distance of the points it would be nice to try with some confirmed data. Are you able to share a few of your sample locations? If you'd like to dummy them up all I really need is horizontal distance&amp;nbsp;between start and sag, sag and end, and the vertical locations of &amp;nbsp;the start, sag and end. You could also just represent&amp;nbsp;the sag location as a % of the whole distance if you'd like to generalize more. Important bit is vertical locations.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6;" width="100%"&gt;&lt;THEAD&gt;&lt;TR style="background-color: #efefef;"&gt;&lt;TH&gt;ID&lt;/TH&gt;&lt;TH&gt;Start to Sag (m)&lt;/TH&gt;&lt;TH&gt;Sag to End (m)&lt;/TH&gt;&lt;TH&gt;Start Z&lt;/TH&gt;&lt;TH&gt;Sag Z&lt;/TH&gt;&lt;TH&gt;End Z&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;5 (50% of&amp;nbsp;total)&lt;/TD&gt;&lt;TD&gt;5&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;8&amp;nbsp;(44.444% of total)&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2020 11:57:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451062#M35355</guid>
      <dc:creator>CodyScott</dc:creator>
      <dc:date>2020-06-16T11:57:07Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating "best fit" line feature based on three height values</title>
      <link>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451063#M35356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Then it could get real ugly, especially if the end points are at different elevations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://electricalengineerresources.com/2018/02/16/sample-calculation-of-sag-and-tension-in-transmission-line-uneven-elevation/" title="https://electricalengineerresources.com/2018/02/16/sample-calculation-of-sag-and-tension-in-transmission-line-uneven-elevation/"&gt;https://electricalengineerresources.com/2018/02/16/sample-calculation-of-sag-and-tension-in-transmission-line-uneven-ele…&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2020 15:03:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451063#M35356</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-06-16T15:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating "best fit" line feature based on three height values  </title>
      <link>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451064#M35357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, the curve will change based on the distance and elevation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you already know the start/sag/end XYZ you should be able to solve the curve for the shape though through some iteration.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i did this as a quick test that you're welcome to try/confirm if correct or not.&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://gist.github.com/namur007/e6184f15b22a0ac89c8bd8f420879e77" title="https://gist.github.com/namur007/e6184f15b22a0ac89c8bd8f420879e77"&gt;Catenary Curve · GitHub&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2020 15:27:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451064#M35357</guid>
      <dc:creator>CodyScott</dc:creator>
      <dc:date>2020-06-16T15:27:02Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating "best fit" line feature based on three height values</title>
      <link>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451065#M35358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That look good. Having some real world data would be interesting to see if the sag is relatively the same for segments with similar elevation differences&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/496779_sage_curve.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2020 15:47:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451065#M35358</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-06-16T15:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating "best fit" line feature based on three height values</title>
      <link>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451066#M35359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;awesome. that array in the gist should be [distance from start to sag, distance from sag to end, start Z, sag Z, end Z]. I'm curious if you run it on some of your data with different start/end elevations how the profile plots too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the function should let you generate your Z locations for your polyline vertexes, which you would just need to calculate over the start to end for&amp;nbsp;the feature. essentially that would be the % along the line from start to sag/sag to end for the respective functions. then just use arcpy to update the polyline with your new vertex attributes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do this for ever feature and you should be set!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2020 18:36:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451066#M35359</guid>
      <dc:creator>CodyScott</dc:creator>
      <dc:date>2020-06-16T18:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating "best fit" line feature based on three height values  </title>
      <link>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451067#M35360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We will have to await for &lt;A href="https://community.esri.com/migrated-users/320326"&gt;Hugo Bouckaert&lt;/A&gt;‌ to get back to us&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2020 19:47:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451067#M35360</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-06-16T19:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating "best fit" line feature based on three height values</title>
      <link>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451068#M35361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ah! sorry i thought i was replying to Hugo, but didn't look close enough! Cheers!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2020 19:58:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451068#M35361</guid>
      <dc:creator>CodyScott</dc:creator>
      <dc:date>2020-06-16T19:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating "best fit" line feature based on three height values  </title>
      <link>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451069#M35362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Scott&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for that. Yes I have data that more or less comply with what you are asking for, but also some extra information (see columns below). I have added in your field names and made red the columns I think correspond to yours above.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note however that I did not have a distance "sag to end" so I took horizontal distance and subtracted "distance to max sag" from that, which should be the sag point to end point distance. I also do not have a separate "end z" field, but let's assume for now that it's z height is the same as the start z. So in the data below, I simply copied the column from start z.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/496869_pastedImage_1.png" /&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hugo&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2020 06:46:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451069#M35362</guid>
      <dc:creator>HugoBouckaert1</dc:creator>
      <dc:date>2020-06-17T06:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating "best fit" line feature based on three height values  </title>
      <link>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451070#M35363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That bit of code looks good indeed! I am plugging it into Jupyter and substituting some of my own data&amp;nbsp; to see if this comes out OK. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2020 06:54:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451070#M35363</guid>
      <dc:creator>HugoBouckaert1</dc:creator>
      <dc:date>2020-06-17T06:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating "best fit" line feature based on three height values  </title>
      <link>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451071#M35364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan and&amp;nbsp;Cody&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Come to think of it, I suppose what I am really after is the ability (1) to draw this line in 3D space with XYZ coordinates and (2) to be able to calculate new Z locations given the input of a set distance from the start location. These two things are actually quite similar in the sense that drawing a sag line in 3D would require XYZ vertices along the way which also amounts to calculating the new Z values along the line.&amp;nbsp; Any way this is achievable? Thanks&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2020 07:24:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451071#M35364</guid>
      <dc:creator>HugoBouckaert1</dc:creator>
      <dc:date>2020-06-17T07:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating "best fit" line feature based on three height values</title>
      <link>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451072#M35365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm pretty sure your data is indicating you have different elevations on either end, otherwise the distance to the sag would be in the middle of the curve.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a quick thought (this will need tweaking)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For graphs with different elevations your basically solving the left side then the right side.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For each side you're going to figure out what the&amp;nbsp;curve scale is (from function provided)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Calculate Z difference from Start Z to Sag Z&lt;/P&gt;&lt;P&gt;Calculate the distance between start XY and sag XY (this you should already have based on your table)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Solve left side using above as inputs. Lets call it L_CURVE_VALUE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Determine the XY locations between the start and mid point (something like np.linspace for each of the X and Y should give you a sufficiently density of array of values for your curve).&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example lets say you get 100 points between the start and sag&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Given that your Sag point XY is 0, use something like np.linspace to create array of points from 0 to your distance (start to sag). Use same number of points as XY locations above. lets call this Z_map&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Plug that Z_map into the formula&amp;nbsp;&lt;SPAN style="color: #24292e; background-color: #ffffff;"&gt; ((&lt;SPAN&gt;L_CURVE_VALUE&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #005cc5; background-color: #ffffff;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #24292e; background-color: #ffffff;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #24292e; background-color: #ffffff;"&gt;np&lt;/SPAN&gt;&lt;SPAN style="color: #24292e; background-color: #ffffff;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #6f42c1; background-color: #ffffff;"&gt;cosh&lt;/SPAN&gt;&lt;SPAN style="color: #24292e; background-color: #ffffff;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #24292e; background-color: #ffffff;"&gt;Z_map&lt;/SPAN&gt;&lt;SPAN class="" style="color: #005cc5; background-color: #ffffff;"&gt;/&lt;SPAN style="color: #3d3d3d;"&gt;L_CURVE_VALUE&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #24292e; background-color: #ffffff;"&gt;))&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #005cc5; background-color: #ffffff;"&gt;-&amp;nbsp;&lt;SPAN style="color: #3d3d3d;"&gt;L_CURVE_VALUE&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #24292e; background-color: #ffffff;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #24292e; background-color: #ffffff;"&gt;this is the array of the curve Z points based on your inputs. Let call this Z_TABLE&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Add the Sag Z elevation to the Z_TABLE. This will put it into your proper vertical location, otherwise it would be Z values from 0 to N (being the start elevation). Call this Z_Locations&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Repeat for other side (using different variables for X, Y, Z locations).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Join left side and right side locations together (making sure it goes from Start to Sag, Sag to End in your arrays).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use these as inputs in the arcpy.polyline when creating a new line between points.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2020 13:34:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451072#M35365</guid>
      <dc:creator>CodyScott</dc:creator>
      <dc:date>2020-06-17T13:34:32Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating "best fit" line feature based on three height values  </title>
      <link>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451073#M35366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Cody&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for that. Given that in the above code we have the function&amp;nbsp;def solve_eq, I did this what you suggested in the main body of the code. But surely this can't be right as I am getting an error that it needs a float whereas I am using a tuple for Z_map. Do I have to pass the array values in one by one? I have highlighted what I have done in bold.&amp;nbsp;The values for Z_map are:&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE style="color: #000000; background-color: #ffffff; border: 0px; font-size: 14px; padding: 1px 0px;"&gt;(array([50.  , 48.75, 47.5 , 46.25, 45.  ]), -1.25)&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;# This is the input:&lt;/P&gt;&lt;P&gt;dd = [[10, 10, 50, 45, 50]]&lt;BR /&gt;lx = None&lt;BR /&gt;ly = None&lt;BR /&gt;rx = None&lt;BR /&gt;ry = None&lt;/P&gt;&lt;P&gt;for i in dd:&lt;BR /&gt; dist_1 = i[0]&lt;BR /&gt;sag_1 = i[2]-i[3]&lt;BR /&gt;a_1 = solve_eq(sag_1, dist_1, max_decimals=10)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dist_2 = i[1]&lt;BR /&gt;sag_2 = i[4]-i[3]&lt;BR /&gt;a_2 = solve_eq(sag_2, dist_2, max_decimals=10)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lx = np.linspace(-i[0], 0)&lt;BR /&gt;ly = ((a_1 * np.cosh(lx/a_1))-a_1) + i[3]&lt;BR /&gt; &lt;STRONG&gt;Z_map = np.linspace(10, 45, num=5, retstep=True)&lt;/STRONG&gt;&lt;BR /&gt; # ((L_CURVE_VALUE * np.cosh(Z_map/L_CURVE_VALUE)) - L_CURVE_VALUE)&lt;BR /&gt; &lt;STRONG&gt;ly2 = ((a_1 * np.cosh(Z_map/a_1)) - a_1)&lt;/STRONG&gt;&lt;BR /&gt; print ('ly2 is {0}'.format(ly2))&lt;BR /&gt; ly = np.clip(ly, i[3], i[2])&lt;BR /&gt; print ('ly is {0}'.format(ly))&lt;BR /&gt; &lt;BR /&gt; rx = np.linspace(0, i[1])&lt;BR /&gt; ry = ((a_2 * np.cosh(rx/a_2))-a_2) + i[3]&lt;BR /&gt; ry = np.clip(ry, i[3], i[4])&lt;BR /&gt; &lt;BR /&gt;fig, ax = plt.subplots(1,1, figsize=(20, 10))&lt;BR /&gt;ax.plot(lx, ly)&lt;BR /&gt;ax.plot(rx, ry)&lt;BR /&gt;ax.grid()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hugo&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2020 03:51:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451073#M35366</guid>
      <dc:creator>HugoBouckaert1</dc:creator>
      <dc:date>2020-06-18T03:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating "best fit" line feature based on three height values</title>
      <link>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451074#M35367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Heres what i was thinking: You'll also need the solve_eq from the&amp;nbsp;previous work&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; collections &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; namedtuple

&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;calculate_xy_path&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;_start&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; _end&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; _sag&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; density&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;None&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    
    l_x &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; np&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;linspace&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;_start&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;x&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; _sag&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;x&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; density&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    r_x &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; np&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;linspace&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;_sag&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;x&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; _end&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;x&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; density&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

    l_y &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; np&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;linspace&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;_start&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;y&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; _sag&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;y&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; density&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    r_y &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; np&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;linspace&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;_sag&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;y&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; _end&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;y&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; density&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    
    l_z &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; calculate_z_path&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;_start&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; _sag&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; density&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
    r_z &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; calculate_z_path&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;_sag&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; _end&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; density&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; Path&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;x&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;l_x&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; y&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;l_y&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; z&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;l_z&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; Path&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;x&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;r_x&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; y&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;r_y&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; z&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;r_z&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;


&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;calculate_z_path&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;_start&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; _end&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; density&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    distance &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; math&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;sqrt&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;_start&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;x &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; _end&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;x&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;**&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;_start&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;y &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; _end&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;y&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;**&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    sag_value &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; abs&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;_start&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;z &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; _end&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;z&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    
    bottom_value &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; min&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;_start&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;z&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; _end&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;z&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

    _path &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; np&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;linspace&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; distance&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; density&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    c &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; solve_eq&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;sag_value&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; distance&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; max_decimals&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;3&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    _z_path &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;c &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; np&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;cosh&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;_path&lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt;c&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;c&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    _z_path &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; np&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;clip&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;_z_path&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; sag_value&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; _z_path &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; bottom_value
    

Point &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; namedtuple&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Point"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"x y z"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
Path &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; namedtuple&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Path"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"x y z"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

start_point &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; Point&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;x&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;300&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; y&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;300&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; z&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;50&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
end_point &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; Point&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;x&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;400&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; y&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;400&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; z&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;50&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
sag_point &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; Point&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;x&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;350&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; y&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;350&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; z&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;40&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;


left_path&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; right_path &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; calculate_xy_path&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;start_point&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; end_point&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; sag_point&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;20&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

full_path &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; Path&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
    x&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;np&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;concatenate&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;left_path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;x&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; right_path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;x&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; 
    y&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;np&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;concatenate&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;left_path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;y&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; right_path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;y&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; 
    z&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;np&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;concatenate&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;left_path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;z&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; right_path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;z&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then to test plot&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; matplotlib&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;pyplot &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; plt

fig &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; plt&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;figure&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;figsize&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;10&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;10&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
ax &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; fig&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;add_subplot&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;111&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; projection&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'3d'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

ax&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;plot&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;full_path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;x&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; full_path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;y&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; full_path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;z&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; p &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;start_point&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; sag_point&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; end_point&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    ax&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;scatter&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;p&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;x&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;p&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;y&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;p&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;z&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; c&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'r'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;IMG alt="plot" class="jive-emoji image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/497215_plot.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:08:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451074#M35367</guid>
      <dc:creator>CodyScott</dc:creator>
      <dc:date>2021-12-11T20:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating "best fit" line feature based on three height values  </title>
      <link>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451075#M35368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a million Cody, appreciated, this looks like it is going to work. I will definitely try this out on my data!&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Hugo&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 20 Jun 2020 03:58:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-quot-best-fit-quot-line-feature-based/m-p/451075#M35368</guid>
      <dc:creator>HugoBouckaert1</dc:creator>
      <dc:date>2020-06-20T03:58:31Z</dc:date>
    </item>
  </channel>
</rss>

