<?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: drawing a line with a given starting point coordinates, angle and length in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/drawing-a-line-with-a-given-starting-point/m-p/533876#M41824</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Dan. I have only few lines to draw. Nothing big.&lt;/P&gt;&lt;P&gt;Do you know if those COGO tools are available in Python?&amp;nbsp;I could see how I can use it in my script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm sure people have functions for that already. I thought maybe someone will care to share some knowledge &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;At first, I started writing the calculation but it's a lot of trigonometry and the mistakes I might do will cost more than my wasted time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shay,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 Jun 2017 18:22:45 GMT</pubDate>
    <dc:creator>SvivaManager</dc:creator>
    <dc:date>2017-06-09T18:22:45Z</dc:date>
    <item>
      <title>drawing a line with a given starting point coordinates, angle and length</title>
      <link>https://community.esri.com/t5/python-questions/drawing-a-line-with-a-given-starting-point/m-p/533874#M41822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the last few days I've been working on a Python script that enables me to draw&amp;nbsp;lines in a feature class.&lt;/P&gt;&lt;P&gt;The script gets 3 params -&amp;nbsp;starting point coordinates, angle (degree) and length in km.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After a few hours of investigating for possible implementations, I've decided to drop the mathematical approach and use the pre-made tool called BearingDistanceToLine_management.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My current&amp;nbsp;implementation actually works but the designed is ridiculous! The tool requires two special tables!&lt;/P&gt;&lt;P&gt;I have one table that holds the parameters - I actually&amp;nbsp;do an InsertCursor into a table just for the tool to run!&lt;/P&gt;&lt;P&gt;I have another table, which gets the output when the tool is finished.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the&amp;nbsp;tool is&amp;nbsp;done, I run a searchCursor on the output table, take the output shape data and&amp;nbsp;adds it into a THIRD and final table where I can add my own other columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone recommends a better solution? I have found&amp;nbsp;many articles with a lot of math lessons but no clear solid answer how to do it. I can't waste my time on learning trigonometry for this and pretty surprised ESRI doesn't have a simple pre-made function for that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Shay.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Jun 2017 17:54:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/drawing-a-line-with-a-given-starting-point/m-p/533874#M41822</guid>
      <dc:creator>SvivaManager</dc:creator>
      <dc:date>2017-06-09T17:54:12Z</dc:date>
    </item>
    <item>
      <title>Re: drawing a line with a given starting point coordinates, angle and length</title>
      <link>https://community.esri.com/t5/python-questions/drawing-a-line-with-a-given-starting-point/m-p/533875#M41823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you have a few to do, then this can be done in an &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/manage-data/editing-parcels/bearing-distance-and-deltaxy.htm"&gt;edit session&lt;/A&gt; If the data are not in a table, then the edit session is the way to go.&amp;nbsp; But if you have lots and a table, then the existing tool is best otherwise, roll out your own using python or numpy.&amp;nbsp; If you create functions or use someone elses, then you can reuse the code again.&amp;nbsp; It is a matter of skill, preference, and data structure and amount which method you choose&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Jun 2017 18:14:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/drawing-a-line-with-a-given-starting-point/m-p/533875#M41823</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-06-09T18:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: drawing a line with a given starting point coordinates, angle and length</title>
      <link>https://community.esri.com/t5/python-questions/drawing-a-line-with-a-given-starting-point/m-p/533876#M41824</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Dan. I have only few lines to draw. Nothing big.&lt;/P&gt;&lt;P&gt;Do you know if those COGO tools are available in Python?&amp;nbsp;I could see how I can use it in my script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm sure people have functions for that already. I thought maybe someone will care to share some knowledge &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;At first, I started writing the calculation but it's a lot of trigonometry and the mistakes I might do will cost more than my wasted time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shay,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Jun 2017 18:22:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/drawing-a-line-with-a-given-starting-point/m-p/533876#M41824</guid>
      <dc:creator>SvivaManager</dc:creator>
      <dc:date>2017-06-09T18:22:45Z</dc:date>
    </item>
    <item>
      <title>Re: drawing a line with a given starting point coordinates, angle and length</title>
      <link>https://community.esri.com/t5/python-questions/drawing-a-line-with-a-given-starting-point/m-p/533877#M41825</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found a nice link on Stack Exchange (hey &lt;A href="https://community.esri.com/people/whuber"&gt;whuber&lt;/A&gt;!) with an arcpy geometry example too!&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://gis.stackexchange.com/questions/6724/creating-line-of-varying-distance-from-origin-point-using-python-in-arcgis-deskt" title="https://gis.stackexchange.com/questions/6724/creating-line-of-varying-distance-from-origin-point-using-python-in-arcgis-deskt"&gt;arcpy - Creating line of varying distance from origin point using Python in ArcGIS Desktop? - Geographic Information Sys…&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Remember if you create arcpy geometry objects&amp;nbsp;GP can read them as a dataset, so, for example, you can convert them to features using Copy Features.&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/analyze/python/using-geometry-objects-with-geoprocessing-tools.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/python/using-geometry-objects-with-geoprocessing-tools.htm"&gt;Using geometry objects with geoprocessing tools—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 11 Jun 2017 01:13:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/drawing-a-line-with-a-given-starting-point/m-p/533877#M41825</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2017-06-11T01:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: drawing a line with a given starting point coordinates, angle and length</title>
      <link>https://community.esri.com/t5/python-questions/drawing-a-line-with-a-given-starting-point/m-p/533878#M41826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The Bearing Distance to Line tool is designed to work on sets of data like most geoprocessing tools.&amp;nbsp; As Dan points out, if you are up for a little scripting, the &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-classes/geometry.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;ArcPy Geometry&lt;/A&gt; classes have a pointFromAngleAndDistance() method that can used to create a line.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;lineFromAngleAndDistance&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;geometry&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; angle&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; distance&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; method&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"GEODESIC"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; SR &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; geometry&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;spatialReference
&amp;nbsp;&amp;nbsp;&amp;nbsp; pt1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; geometry&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;firstPoint
&amp;nbsp;&amp;nbsp;&amp;nbsp; pt2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; geometry&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;pointFromAngleAndDistance&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; angle&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; distance&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; method
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;firstPoint
&amp;nbsp;&amp;nbsp;&amp;nbsp; polyline &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Polyline&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Array&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;pt1&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; pt2&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; SR&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; polyline&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:12:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/drawing-a-line-with-a-given-starting-point/m-p/533878#M41826</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-11T23:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: drawing a line with a given starting point coordinates, angle and length</title>
      <link>https://community.esri.com/t5/python-questions/drawing-a-line-with-a-given-starting-point/m-p/533879#M41827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's perfect thank you! I guess I misunderstood Dan but this snippet helps a lot thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jun 2017 16:19:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/drawing-a-line-with-a-given-starting-point/m-p/533879#M41827</guid>
      <dc:creator>SvivaManager</dc:creator>
      <dc:date>2017-06-14T16:19:31Z</dc:date>
    </item>
    <item>
      <title>Re: drawing a line with a given starting point coordinates, angle and length</title>
      <link>https://community.esri.com/t5/python-questions/drawing-a-line-with-a-given-starting-point/m-p/533880#M41828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot! I'll check it out&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jun 2017 16:20:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/drawing-a-line-with-a-given-starting-point/m-p/533880#M41828</guid>
      <dc:creator>SvivaManager</dc:creator>
      <dc:date>2017-06-14T16:20:47Z</dc:date>
    </item>
  </channel>
</rss>

