<?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 How to copy fc datasets and define projection in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-copy-fc-datasets-and-define-projection/m-p/264184#M20347</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; I am new to the world of python. I have a geodatabase with feature datasets and multiple types of feature classes within those datasets. I'm trying to write a script that will search through the specified geodatabase and copy items into new datasets within a new geodatabase. I also need to define a projection for the data as it goes into the new gdb.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've been doing it manually in ArcCatalog by creating a new dataset in the target gdb and defining a projection, then importing the feature classes into it. However this has been pretty time consuming.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what I have so far for my script,&amp;nbsp;I think I may be completely lost and I'm not sure if .da.Walk is what I should be using&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gdbFrom = arcpy.GetParameterAsText(0)&lt;BR /&gt;gdbTo = arcpy.GetParameterAsText(1)&lt;BR /&gt;Projection = arcpy.GetParameterAsText(2)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for datasets in arcpy.da.Walk(gdbFrom): &lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;for fc in datasets:&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 26 Jan 2019 21:20:19 GMT</pubDate>
    <dc:creator>KimCollins</dc:creator>
    <dc:date>2019-01-26T21:20:19Z</dc:date>
    <item>
      <title>How to copy fc datasets and define projection</title>
      <link>https://community.esri.com/t5/python-questions/how-to-copy-fc-datasets-and-define-projection/m-p/264184#M20347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; I am new to the world of python. I have a geodatabase with feature datasets and multiple types of feature classes within those datasets. I'm trying to write a script that will search through the specified geodatabase and copy items into new datasets within a new geodatabase. I also need to define a projection for the data as it goes into the new gdb.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've been doing it manually in ArcCatalog by creating a new dataset in the target gdb and defining a projection, then importing the feature classes into it. However this has been pretty time consuming.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what I have so far for my script,&amp;nbsp;I think I may be completely lost and I'm not sure if .da.Walk is what I should be using&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gdbFrom = arcpy.GetParameterAsText(0)&lt;BR /&gt;gdbTo = arcpy.GetParameterAsText(1)&lt;BR /&gt;Projection = arcpy.GetParameterAsText(2)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for datasets in arcpy.da.Walk(gdbFrom): &lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;for fc in datasets:&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 26 Jan 2019 21:20:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-copy-fc-datasets-and-define-projection/m-p/264184#M20347</guid>
      <dc:creator>KimCollins</dc:creator>
      <dc:date>2019-01-26T21:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to copy fc datasets and define projection</title>
      <link>https://community.esri.com/t5/python-questions/how-to-copy-fc-datasets-and-define-projection/m-p/264185#M20348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I typically use the following for crawling through unknown database feature datasets and feature classes:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;arcpy.env.workspace = &lt;SPAN style="background-color: #ffffff;"&gt;gdbFrom&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;for ds in arcpy.ListDatasets(feature_type='feature')&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; &amp;nbsp;do what you need with each feature dataset&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;for fc in arcpy.ListFeatureClasses(feature_dataset=ds):&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; do what you need here for each feature class in a dataset&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To define a spacial reference for a dataset:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;cs&amp;nbsp;= arcpy.SpatialReference(4326)&amp;nbsp; &amp;nbsp;# for GCS_WGS_1984 as an example&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;arcpy.DefineProjection_management(dataset, cs)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;If you are not modifying the data just applying a coodinate system and/or transformation to the dataset you could use&amp;nbsp;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/project.htm" title="http://desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/project.htm"&gt;Project—Help | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp;on each feature dataset setting your gbdFrom and gbdTo, in and out coordinate system and transformation if needed.&amp;nbsp; Do not forget about applying a transformation if need or your data may end up in the wrong part of the world.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN&gt;cs&amp;nbsp;= arcpy.SpatialReference(4326)&amp;nbsp; &amp;nbsp;# for GCS_WGS_1984 as an example&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN&gt;arcpy.Project_management(gdbFrom/in_dataset, gbdTo/out_dataset, cs)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-functions/listdatasets.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-functions/listdatasets.htm"&gt;ListDatasets—Help | ArcGIS Desktop&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A class="link-titled" href="http://pro.arcgis.com/en/pro-app/arcpy/functions/listfeatureclasses.htm" title="http://pro.arcgis.com/en/pro-app/arcpy/functions/listfeatureclasses.htm"&gt;ListFeatureClasses—ArcPy Functions | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-classes/spatialreference.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-classes/spatialreference.htm"&gt;SpatialReference—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/define-projection.htm" title="http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/define-projection.htm"&gt;Define Projection—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A class="" href="http://desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/project.htm" style="color: #2989c5; text-decoration: underline;" title="http://desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/project.htm"&gt;Project—Help | ArcGIS for Desktop&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 26 Jan 2019 21:48:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-copy-fc-datasets-and-define-projection/m-p/264185#M20348</guid>
      <dc:creator>LanceCole</dc:creator>
      <dc:date>2019-01-26T21:48:25Z</dc:date>
    </item>
  </channel>
</rss>

