<?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: Load shapefile in arcmap using python script in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/load-shapefile-in-arcmap-using-python-script/m-p/587093#M19446</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes sir, I want to generate straight line distances to each of them to an output folder.By the way, my files are point shapefile.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When I run the above script, nothing is loading to mxd document.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much for your help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Raj&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Mar 2012 19:01:06 GMT</pubDate>
    <dc:creator>rrjs67</dc:creator>
    <dc:date>2012-03-21T19:01:06Z</dc:date>
    <item>
      <title>Load shapefile in arcmap using python script</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/load-shapefile-in-arcmap-using-python-script/m-p/587091#M19444</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am a novice in Python. Please help me to load the shapefile into&amp;nbsp; arcmap and generate straight line distances for each of them in a&amp;nbsp; folder.&amp;nbsp; Thanks&amp;nbsp; Raj&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Mar 2012 17:20:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/load-shapefile-in-arcmap-using-python-script/m-p/587091#M19444</guid>
      <dc:creator>rrjs67</dc:creator>
      <dc:date>2012-03-21T17:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: Load shapefile in arcmap using python script</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/load-shapefile-in-arcmap-using-python-script/m-p/587092#M19445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This will add the feature class specified in "fc" to the current map document. Run as a script from inside ArcMap.&lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy

fc = "H:/GIS_Data/TEMP.gdb/polygons"
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]

arcpy.MakeFeatureLayer_management(fc, "poly")
addLayer = arcpy.mapping.Layer("poly")
arcpy.mapping.AddLayer(df,addLayer)&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;What do you mean by "generate straight line distances for each of them in a folder"?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:14:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/load-shapefile-in-arcmap-using-python-script/m-p/587092#M19445</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2021-12-12T01:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: Load shapefile in arcmap using python script</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/load-shapefile-in-arcmap-using-python-script/m-p/587093#M19446</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes sir, I want to generate straight line distances to each of them to an output folder.By the way, my files are point shapefile.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When I run the above script, nothing is loading to mxd document.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much for your help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Raj&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Mar 2012 19:01:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/load-shapefile-in-arcmap-using-python-script/m-p/587093#M19446</guid>
      <dc:creator>rrjs67</dc:creator>
      <dc:date>2012-03-21T19:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: Load shapefile in arcmap using python script</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/load-shapefile-in-arcmap-using-python-script/m-p/587094#M19447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am getting the error message for the code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color:#ff0000;"&gt;Traceback (most recent call last):&lt;BR /&gt;&amp;nbsp; File "H:\Desktop\Load_shp.py", line 4, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument("CURRENT")&lt;BR /&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\arcobjects\mixins.py", line 444, in __init__&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; super(MapDocumentMethods, self).__init__(mxd)&lt;BR /&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\arcobjects\_base.py", line 47, in __init__&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for arg in args))&lt;BR /&gt;RuntimeError: Object: CreateObject cannot open map document&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, after spending awhile on this, I could write small script that loads the point shp file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;the code is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color:#0000ff;"&gt;import arcpy&lt;BR /&gt;# get the map document&lt;BR /&gt;mxd = arcpy.mapping.MapDocument(r"C:\Research-gravity\Huff\Santhi\SGravity\StLine.mxd")&lt;BR /&gt;# Set the workspace&lt;BR /&gt;arcpy.env.workspace = r"C:\Research-gravity\Huff\Santhi\SGravity"&lt;BR /&gt;# get the data frame&lt;BR /&gt;df = arcpy.mapping.ListDataFrames(mxd,"*")[0]&lt;BR /&gt;# create a new layer&lt;BR /&gt;newlayer = arcpy.mapping.Layer(r"C:\Research-gravity\Huff\Santhi\SGravity\points.shp")&lt;BR /&gt;# add the layer to the map at the bottom of the TOC in data frame 0&lt;BR /&gt;arcpy.mapping.AddLayer(df, newlayer,"AUTO_ARRANGE")&lt;BR /&gt;# save the mxd file&lt;BR /&gt;mxd.save()&lt;BR /&gt;del mxd&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Now I need to calculate straight line distances for the point shape file. could you please help me?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I greatly appreciate your help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Raj&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Mar 2012 20:05:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/load-shapefile-in-arcmap-using-python-script/m-p/587094#M19447</guid>
      <dc:creator>rrjs67</dc:creator>
      <dc:date>2012-03-21T20:05:46Z</dc:date>
    </item>
  </channel>
</rss>

