<?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: How to input a shapefile in my Python script? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-input-a-shapefile-in-my-python-script/m-p/41558#M3310</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks a lot for your answers &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt; It worked!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Nov 2013 10:34:43 GMT</pubDate>
    <dc:creator>ChloeAsmar</dc:creator>
    <dc:date>2013-11-14T10:34:43Z</dc:date>
    <item>
      <title>How to input a shapefile in my Python script?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-input-a-shapefile-in-my-python-script/m-p/41554#M3306</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello all!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So I am really new to Python.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I had to convert a Matlab Script into Python script in order to be able to add it as a script tool in Arcmap.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am having a hard time figuring out how to input a shapefile into my script. My whole script runs based on the shapefile so I have no way of checking if it works unless it reads the shapefile.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Nov 2013 10:43:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-input-a-shapefile-in-my-python-script/m-p/41554#M3306</guid>
      <dc:creator>ChloeAsmar</dc:creator>
      <dc:date>2013-11-13T10:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to input a shapefile in my Python script?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-input-a-shapefile-in-my-python-script/m-p/41555#M3307</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hello all!&lt;BR /&gt;&lt;BR /&gt;So I am really new to Python.&lt;BR /&gt;&lt;BR /&gt;I had to convert a Matlab Script into Python script in order to be able to add it as a script tool in Arcmap.&lt;BR /&gt; &lt;BR /&gt;I am having a hard time figuring out how to input a shapefile into my script. My whole script runs based on the shapefile so I have no way of checking if it works unless it reads the shapefile.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance!!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you run the script standalone, then you just use the path to the ".shp" file like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
inputShp = r'C:\Path\to\some\shapefile.shp'
outputShp = r'C:\Path\to\other\shapefile.shp'

# do something with the shapefile
arcpy.CopyFeatures_management(inputShp, outputShp)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you added the script&amp;nbsp; to a Toolbox and the shapefile is a parameter, &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//00150000000n000000" rel="nofollow noopener noreferrer" target="_blank"&gt;define the parameter&lt;/A&gt;&lt;SPAN&gt; as shapefile and read it from the script like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
inputShp = arcpy.GetParameterAsText(0)

# do something with the shapefile
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If this is not what you're looking for then share the code and we can have a look at it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Xander&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:36:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-input-a-shapefile-in-my-python-script/m-p/41555#M3307</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-10T21:36:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to input a shapefile in my Python script?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-input-a-shapefile-in-my-python-script/m-p/41556#M3308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have you checked out &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00150000000n000000.htm"&gt;this article&lt;/A&gt;&lt;SPAN&gt; about working with inputs? If you need to actually do something with an ArcGIS tool, you may also need to use &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00170000006p000000"&gt;Make Feature Layer &lt;/A&gt;&lt;SPAN&gt;first, depending on the tool.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Nov 2013 12:18:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-input-a-shapefile-in-my-python-script/m-p/41556#M3308</guid>
      <dc:creator>DouglasSands</dc:creator>
      <dc:date>2013-11-13T12:18:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to input a shapefile in my Python script?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-input-a-shapefile-in-my-python-script/m-p/41557#M3309</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks a lot for your answers &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt; It worked!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 10:20:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-input-a-shapefile-in-my-python-script/m-p/41557#M3309</guid>
      <dc:creator>ChloeAsmar</dc:creator>
      <dc:date>2013-11-14T10:20:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to input a shapefile in my Python script?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-input-a-shapefile-in-my-python-script/m-p/41558#M3310</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks a lot for your answers &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt; It worked!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 10:34:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-input-a-shapefile-in-my-python-script/m-p/41558#M3310</guid>
      <dc:creator>ChloeAsmar</dc:creator>
      <dc:date>2013-11-14T10:34:43Z</dc:date>
    </item>
  </channel>
</rss>

