<?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: Toolbox Script to Make a Line on the map in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/toolbox-script-to-make-a-line-on-the-map/m-p/486340#M37964</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;.....still looking for any help on invalid characters with CreateFeatureclass_management, still getting the error after correcting the backslash mistake...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GD&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Apr 2011 22:25:17 GMT</pubDate>
    <dc:creator>GregDelapaix</dc:creator>
    <dc:date>2011-04-27T22:25:17Z</dc:date>
    <item>
      <title>Toolbox Script to Make a Line on the map</title>
      <link>https://community.esri.com/t5/python-questions/toolbox-script-to-make-a-line-on-the-map/m-p/486332#M37956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey all-&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to place the following script into a toolbox I created. The idea is that it receives user input for x and y origins (decimal degrees), distance and angle. Distance, along with origin_x and origin_y are linear measurements, angle is set as 'any value'- I'm not sure if this is correct, but the idea with angle is that it would be a number from 0 to 360 with North being 0, West being 90, etc. I also want to make sure the script references the map properly, to create a line using the input parameters.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my script so far, when I run it I get the following error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;type 'exceptions.TypeError'&amp;gt;: unsupported operand type(s) for /: 'unicode' and 'float'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (Script). I would GREATLY appreciate any help&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Code is as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from math import radians, sin, cos, pi&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;origin_x&amp;nbsp;&amp;nbsp; = arcpy.GetParameterAsText(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;origin_y&amp;nbsp; = arcpy.GetParameterAsText(1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;distance&amp;nbsp; = arcpy.GetParameterAsText(2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;angle&amp;nbsp; = arcpy.GetParameterAsText(3)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# convert latitude and longitude to radians&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;origin_x = origin_x/(180/pi)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;origin_y = origin_y/(180/pi)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# calculate offsets with light trig&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(disp_x, disp_y) = (distance * sin(radians(angle)), distance * cos(radians(angle)))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(end_x, end_y) = (origin_x + disp_x, origin_y + disp_y)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;output = "offset-line.shp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.CreateFeatureClassManagement("G:\Delapaix\line_connect\line_connect", output, "Polyline")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;cur = arcpy.InsertCursor(output)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lineArray = arcpy.Array()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# start point&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;start = arcpy.Point()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(start.ID, start.X, start.Y) = (1, origin_x, origin_y)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lineArray.add(start)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# end point&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;end = arcpy.Point()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(end.ID, end.X, end.Y) = (2, end_x, end_y)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lineArray.add(end)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# write feature to the shapefile&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;feat = cur.newRow()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;feat.shape = lineArray&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;cur.insertRow(feat)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# code for buffering the line and including features in buffer zone would go here&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# yes, this shouldn't really be necessary&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lineArray.removeAll()&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Apr 2011 04:45:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/toolbox-script-to-make-a-line-on-the-map/m-p/486332#M37956</guid>
      <dc:creator>GregDelapaix</dc:creator>
      <dc:date>2011-04-27T04:45:36Z</dc:date>
    </item>
    <item>
      <title>Re: Toolbox Script to Make a Line on the map</title>
      <link>https://community.esri.com/t5/python-questions/toolbox-script-to-make-a-line-on-the-map/m-p/486333#M37957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sorry- forgot to mention that the purpose of the script is to create a line on the map, though most probably could figure that out from looking at the code...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Apr 2011 04:54:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/toolbox-script-to-make-a-line-on-the-map/m-p/486333#M37957</guid>
      <dc:creator>GregDelapaix</dc:creator>
      <dc:date>2011-04-27T04:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: Toolbox Script to Make a Line on the map</title>
      <link>https://community.esri.com/t5/python-questions/toolbox-script-to-make-a-line-on-the-map/m-p/486334#M37958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You will note that your&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;origin_x variable is a text parameter (ie GetParameterAsText), hence, you need to cast it to a float value before performing any math operations using it.&amp;nbsp; This line:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;origin_x = origin_x/(180/pi)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;should be&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;origin_x = float(origin_x) / (180 / pi)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You will need to correct the others in the same fashion.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Apr 2011 10:30:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/toolbox-script-to-make-a-line-on-the-map/m-p/486334#M37958</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2011-04-27T10:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: Toolbox Script to Make a Line on the map</title>
      <link>https://community.esri.com/t5/python-questions/toolbox-script-to-make-a-line-on-the-map/m-p/486335#M37959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;@Dan-&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you, that resolved my error. Now, I am getting the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;type 'exceptions.AttributeError'&amp;gt;: 'module' object has no attribute 'CreateFeatureClass'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (Script).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Not sure how to fix this- do I need to create a gdb for the FeatureClass to write to?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The error looks like arcpy has no CreateFeatureClass, which is not the case according to Esri&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00170000002p000000.htm"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00170000002p000000.htm&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'''&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Created on Apr 24, 2011&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;@author: gregdelapaix&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'''&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from arcpy import env&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from math import radians, sin, cos, pi&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Set workspace&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;env.workspace = "G:\Delapaix\Geog_586_FinalProject\line_connect"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;origin_x&amp;nbsp;&amp;nbsp; = arcpy.GetParameterAsText(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;origin_y&amp;nbsp; = arcpy.GetParameterAsText(1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;distance&amp;nbsp; = arcpy.GetParameterAsText(2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;angle&amp;nbsp; = arcpy.GetParameterAsText(3)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# convert latitude and longitude to radians&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;origin_x = float(origin_x)/(180/pi)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;origin_y = float(origin_y)/(180/pi)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# calculate offsets with light trig&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(disp_x, disp_y) = (float(distance) * sin(radians(float(angle))), float(distance) * cos(radians(float(angle))))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(end_x, end_y) = (float(origin_x) + disp_x, float(origin_y) + disp_y)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;output = "offset-line.shp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.CreateFeatureClass_management("G:\Delapaix\Geog_586_FinalProject\line_connect", output, "Polyline")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;cur = arcpy.InsertCursor(output)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lineArray = arcpy.Array()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# start point&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;start = arcpy.Point()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(start.ID, start.X, start.Y) = (1, origin_x, origin_y)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lineArray.add(start)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# end point&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;end = arcpy.Point()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(end.ID, end.X, end.Y) = (2, end_x, end_y)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lineArray.add(end)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# write feature to the shapefile&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;feat = cur.newRow()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;feat.shape = lineArray&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;cur.insertRow(feat)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# code for buffering the line and including features in buffer zone would go here&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# yes, this shouldn't really be necessary&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lineArray.removeAll()&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Apr 2011 20:40:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/toolbox-script-to-make-a-line-on-the-map/m-p/486335#M37959</guid>
      <dc:creator>GregDelapaix</dc:creator>
      <dc:date>2011-04-27T20:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: Toolbox Script to Make a Line on the map</title>
      <link>https://community.esri.com/t5/python-questions/toolbox-script-to-make-a-line-on-the-map/m-p/486336#M37960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Everything in Arcpy is case sensitive, so you should try: CreateFeatureclass_management&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Apr 2011 20:49:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/toolbox-script-to-make-a-line-on-the-map/m-p/486336#M37960</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2011-04-27T20:49:58Z</dc:date>
    </item>
    <item>
      <title>Re: Toolbox Script to Make a Line on the map</title>
      <link>https://community.esri.com/t5/python-questions/toolbox-script-to-make-a-line-on-the-map/m-p/486337#M37961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;@dkwiens Thank you! I stared at the esri documentation for half an hour and didn't see that...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have another error I am unable to figure out, mainly because I'm new to Python, ArcPy, etc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here it is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;class 'arcgisscripting.ExecuteError'&amp;gt;: ERROR 000354: The name contains invalid characters&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (CreateFeatureclass).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (Script).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What might these invalid characters be?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, I am concerned about one other thing, which is that the script doesn't contain information for distance in terms of units- I want it to be in miles- seems like something is missing for the script to create the dataset, let alone place the line on the map with the right units&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any further help GREATLY appreciated&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;GD&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Apr 2011 21:19:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/toolbox-script-to-make-a-line-on-the-map/m-p/486337#M37961</guid>
      <dc:creator>GregDelapaix</dc:creator>
      <dc:date>2011-04-27T21:19:23Z</dc:date>
    </item>
    <item>
      <title>Re: Toolbox Script to Make a Line on the map</title>
      <link>https://community.esri.com/t5/python-questions/toolbox-script-to-make-a-line-on-the-map/m-p/486338#M37962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Not to mention, that Python requires all paths to be forward slashes "/" and not backslashes, or use double backslashes "\\" or the "raw" identifier (see python help) if you insist in using backslashes&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Apr 2011 21:21:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/toolbox-script-to-make-a-line-on-the-map/m-p/486338#M37962</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2011-04-27T21:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: Toolbox Script to Make a Line on the map</title>
      <link>https://community.esri.com/t5/python-questions/toolbox-script-to-make-a-line-on-the-map/m-p/486339#M37963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Dan, that did cross my mind at one point though I forgot. I'm using ArcMap on a remote server via a Citrix plug-in, and I am used to forward slashes, but I thought for the Windows machine I maybe needed backslashes... oi&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Apr 2011 21:34:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/toolbox-script-to-make-a-line-on-the-map/m-p/486339#M37963</guid>
      <dc:creator>GregDelapaix</dc:creator>
      <dc:date>2011-04-27T21:34:18Z</dc:date>
    </item>
    <item>
      <title>Re: Toolbox Script to Make a Line on the map</title>
      <link>https://community.esri.com/t5/python-questions/toolbox-script-to-make-a-line-on-the-map/m-p/486340#M37964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;.....still looking for any help on invalid characters with CreateFeatureclass_management, still getting the error after correcting the backslash mistake...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GD&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Apr 2011 22:25:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/toolbox-script-to-make-a-line-on-the-map/m-p/486340#M37964</guid>
      <dc:creator>GregDelapaix</dc:creator>
      <dc:date>2011-04-27T22:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: Toolbox Script to Make a Line on the map</title>
      <link>https://community.esri.com/t5/python-questions/toolbox-script-to-make-a-line-on-the-map/m-p/486341#M37965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The shapefile you're trying to make has an invalid name (output = "offset-line.shp"). No hyphens allowed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Interestingly, I was able to make a shapefile with a hyphenated name by right-clicking and choosing new shapefile. I didn't try to do anything with it, though, so who knows if it's a functional shapefile...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2011 01:56:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/toolbox-script-to-make-a-line-on-the-map/m-p/486341#M37965</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2011-04-28T01:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: Toolbox Script to Make a Line on the map</title>
      <link>https://community.esri.com/t5/python-questions/toolbox-script-to-make-a-line-on-the-map/m-p/486342#M37966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;@dkwiens&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you that fixed it!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If possible, I am in need of further assistance- I am attempting to make the line appear on a map which is in the same folder the shapefile is created in. As it is now, it creates the shapefile, but not the line on a map. Do I need to create a geodatabase to place the shapefile in? Otherwise I'm not sure about the script being able to detect the projection/coordinate system. I'm also not sure about making sure the units for the length of the line are consistent, in this case miles&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my script as it currently stands:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'''&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Created on Apr 24, 2011&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;@author: gregdelapaix&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'''&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from arcpy import env&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from math import radians, sin, cos, pi&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Set workspace&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;env.workspace = "G:\\Delapaix\\Geog_586_FinalProject\\line_connect"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;origin_x&amp;nbsp;&amp;nbsp; = arcpy.GetParameterAsText(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;origin_y&amp;nbsp; = arcpy.GetParameterAsText(1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;distance&amp;nbsp; = arcpy.GetParameterAsText(2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;angle&amp;nbsp; = arcpy.GetParameterAsText(3)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# convert latitude and longitude to radians&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;origin_x = float(origin_x)/(180/pi)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;origin_y = float(origin_y)/(180/pi)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# calculate offsets with light trig&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(disp_x, disp_y) = (float(distance) * sin(radians(float(angle))), float(distance) * cos(radians(float(angle))))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(end_x, end_y) = (float(origin_x) + disp_x, float(origin_y) + disp_y)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;output = "offsetLine.shp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.CreateFeatureclass_management("G:\\Delapaix\\Geog_586_FinalProject\\line_connect", output, "Polyline")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;cur = arcpy.InsertCursor(output)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lineArray = arcpy.Array()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# start point&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;start = arcpy.Point()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(start.ID, start.X, start.Y) = (1, origin_x, origin_y)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lineArray.add(start)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# end point&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;end = arcpy.Point()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(end.ID, end.X, end.Y) = (2, end_x, end_y)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lineArray.add(end)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# write feature to the shapefile&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;feat = cur.newRow()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;feat.shape = lineArray&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;cur.insertRow(feat)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# code for placing the line on the map here(?)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# code for buffering the line and including features in buffer zone would go here&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# should I remove this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lineArray.removeAll()&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2011 03:46:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/toolbox-script-to-make-a-line-on-the-map/m-p/486342#M37966</guid>
      <dc:creator>GregDelapaix</dc:creator>
      <dc:date>2011-04-28T03:46:45Z</dc:date>
    </item>
  </channel>
</rss>

