<?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: Python: Output Dataset or Feature Class is same as input Input Dataset  in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-output-dataset-or-feature-class-is-same-as/m-p/111781#M8704</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;a wei,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do the coordinate systems have a different datum?&amp;nbsp; If so, it might be necessary to include a transform method in your parameters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 30 Jun 2015 15:20:56 GMT</pubDate>
    <dc:creator>TomSellsted</dc:creator>
    <dc:date>2015-06-30T15:20:56Z</dc:date>
    <item>
      <title>Python: Output Dataset or Feature Class is same as input Input Dataset</title>
      <link>https://community.esri.com/t5/python-questions/python-output-dataset-or-feature-class-is-same-as/m-p/111780#M8703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to project certain vectors in my folder so I wrote the following code. It gives me error message:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;&amp;nbsp; File "F:/soil/python/code-project", line 34, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Project_management(infc, outfc, outCS)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\management.py", line 8221, in Project&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;ExecuteError: Failed to execute. Parameters are not valid.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;ERROR 000670: output Output Dataset or Feature Class is same as input Input Dataset or Feature Class&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;Failed to execute (Project).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I'm pretty sure my input and output workspace is not the same. Here's the code:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import os


arcpy.env.workspace = "F:/soil/python"
arcpy.env.overwriteOutput = True
outWorkspace = "D:/soil/project"
feature_classes = []
outCS = arcpy.SpatialReference()
outCS.factoryCode = 3174
outCS.create()


walk = arcpy.da.Walk(arcpy.env.workspace, datatype="FeatureClass", type="Polygon")


for dirpath, dirnames, filenames in walk:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if "Subbasin" in filenames:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; filenames.remove('Subbasin')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for filename in filenames:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; feature_classes.append(os.path.join(dirpath, filename))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
print feature_classes


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
for infc in feature_classes:
&amp;nbsp;&amp;nbsp;&amp;nbsp; dsc = arcpy.Describe(infc)


&amp;nbsp;&amp;nbsp;&amp;nbsp; if dsc.spatialReference.Name == "Unknown":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print('skipped this fc due to undefined coordinate system: ' + infc)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Determine the new output feature class path and name
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outfc = os.path.join(outWorkspace, infc)


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # project data
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Project_management(infc, outfc, outCS)&lt;/PRE&gt;&lt;P&gt;Thanks for any help!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:41:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-output-dataset-or-feature-class-is-same-as/m-p/111780#M8703</guid>
      <dc:creator>awei</dc:creator>
      <dc:date>2021-12-11T06:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: Python: Output Dataset or Feature Class is same as input Input Dataset</title>
      <link>https://community.esri.com/t5/python-questions/python-output-dataset-or-feature-class-is-same-as/m-p/111781#M8704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;a wei,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do the coordinate systems have a different datum?&amp;nbsp; If so, it might be necessary to include a transform method in your parameters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jun 2015 15:20:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-output-dataset-or-feature-class-is-same-as/m-p/111781#M8704</guid>
      <dc:creator>TomSellsted</dc:creator>
      <dc:date>2015-06-30T15:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: Python: Output Dataset or Feature Class is same as input Input Dataset</title>
      <link>https://community.esri.com/t5/python-questions/python-output-dataset-or-feature-class-is-same-as/m-p/111782#M8705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Wei,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the problem is with how you are setting the outfc variable.&amp;nbsp; It looks like you are joining &lt;SPAN class="string"&gt;"D:/soil/project" to the full path of the infc.&amp;nbsp; I would add a print statement for the outfc.&amp;nbsp; I believe it's going to be:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="string"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="string"&gt;D:\soil\project\F:\soil\python\[feature class]&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jun 2015 15:31:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-output-dataset-or-feature-class-is-same-as/m-p/111782#M8705</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2015-06-30T15:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: Python: Output Dataset or Feature Class is same as input Input Dataset</title>
      <link>https://community.esri.com/t5/python-questions/python-output-dataset-or-feature-class-is-same-as/m-p/111783#M8706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's not. It's the original location of the input file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jun 2015 15:46:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-output-dataset-or-feature-class-is-same-as/m-p/111783#M8706</guid>
      <dc:creator>awei</dc:creator>
      <dc:date>2015-06-30T15:46:36Z</dc:date>
    </item>
    <item>
      <title>Re: Python: Output Dataset or Feature Class is same as input Input Dataset</title>
      <link>https://community.esri.com/t5/python-questions/python-output-dataset-or-feature-class-is-same-as/m-p/111784#M8707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;for infc in feature_classes:
&amp;nbsp;&amp;nbsp;&amp;nbsp; infc = infc.split("\\")[-1]
&amp;nbsp;&amp;nbsp;&amp;nbsp; dsc = arcpy.Describe(infc)&amp;nbsp; 
&amp;nbsp; 
&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; if dsc.spatialReference.Name == "Unknown":&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print('skipped this fc due to undefined coordinate system: ' + infc)&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Determine the new output feature class path and name
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outfc = os.path.join(outWorkspace, infc)&amp;nbsp; 
&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # project data&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Project_management(infc, outfc, outCS) &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:41:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-output-dataset-or-feature-class-is-same-as/m-p/111784#M8707</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T06:41:52Z</dc:date>
    </item>
  </channel>
</rss>

