<?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: Exploring spatial data in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/exploring-spatial-data/m-p/501990#M39440</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;'Challenge' 1:&lt;/STRONG&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
arcpy.env.workspace = r'C:\Project\999999\myFGDB.gdb'&amp;nbsp; # example FileGeodatabase as workspace
arcpy.env.workspace = r'C:\Project\999999\mySHPfolder'&amp;nbsp; # example folder (with shapefiles) as workspace
fclasses = arcpy.ListFeatureClasses()

for fclass in fclasses:
&amp;nbsp;&amp;nbsp;&amp;nbsp; fctype = arcpy.Describe(fclass).shapeType
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "{0} is a {1} feature class".format(fclass, fctype)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;'Challenge' 2:&lt;/STRONG&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os
arcpy.env.workspace = r'C:\Project\999999\mySHPfolder'
fclasses = arcpy.ListFeatureClasses()

out_ws_all = r'C:\Project\999999\test_all.gdb'
out_ws_pol = r'C:\Project\999999\test_pol.gdb'

for fclass in fclasses:
&amp;nbsp;&amp;nbsp;&amp;nbsp; fctype = arcpy.Describe(fclass).shapeType
&amp;nbsp;&amp;nbsp;&amp;nbsp; newname = fclass
&amp;nbsp;&amp;nbsp;&amp;nbsp; if newname[-4:].upper() == ".SHP":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newname = newname[:-4] # trim the .shp extension from the name
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_fc = os.path.join(out_ws_all, fclass)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(fclass, out_fc)
&amp;nbsp;&amp;nbsp;&amp;nbsp; if fctype == 'Polygon':
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; out_fc = os.path.join(out_ws_pol, fclass)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(fclass, out_fc)&lt;/PRE&gt;&lt;BR /&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>Sat, 11 Dec 2021 22:01:57 GMT</pubDate>
    <dc:creator>XanderBakker</dc:creator>
    <dc:date>2021-12-11T22:01:57Z</dc:date>
    <item>
      <title>Exploring spatial data</title>
      <link>https://community.esri.com/t5/python-questions/exploring-spatial-data/m-p/501988#M39438</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have been working on this for hours and am getting increasingly frustrated. i do not know how to get these answers or what code to put in. I have followed through all of the lab walkthroughs and have searched online, nothing is providing me with a proper answer. I dont necessarily need someone to figure it out for me but i need something to put into arcMap python that will provide me with these answers. An explanation on what to do for each step with code to type in would be appreciated. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have been provided with data from the lab exercise, however i would have to attach over 20 items to provide them. So as i said a code sequence to get me to where i need to be would work for me&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Challenge 1:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Write a script that reads all the feature classes in a workspace and prints&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;the name of each feature class and the geometry type of that feature&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;class in the following format:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;streams is a point feature class&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Challenge 2:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Write a script that reads all the feature classes in a personal or file&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;geodatabase and copies only the polygon feature classes to a new file&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;geodatabase. You can assume there are no feature datasets in the existing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;data, and the feature classes can keep the same name.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Feb 2014 22:59:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exploring-spatial-data/m-p/501988#M39438</guid>
      <dc:creator>JacobWagner</dc:creator>
      <dc:date>2014-02-24T22:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: Exploring spatial data</title>
      <link>https://community.esri.com/t5/python-questions/exploring-spatial-data/m-p/501989#M39439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am surprised that you say you can find nothing to help you.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The ArcGIS help is full of code samples.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Try here&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/#/ListFeatureClasses/03q300000023000000/"&gt;http://resources.arcgis.com/en/help/main/10.2/#/ListFeatureClasses/03q300000023000000/&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;and&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/#/ListRasters/03q30000005m000000/"&gt;http://resources.arcgis.com/en/help/main/10.2/#/ListRasters/03q30000005m000000/&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;and&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/#/Describe/03q30000008q000000/"&gt;http://resources.arcgis.com/en/help/main/10.2/#/Describe/03q30000008q000000/&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;for starters.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Lots of other stuff.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Good luck.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2014 07:22:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exploring-spatial-data/m-p/501989#M39439</guid>
      <dc:creator>NeilAyres</dc:creator>
      <dc:date>2014-02-25T07:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: Exploring spatial data</title>
      <link>https://community.esri.com/t5/python-questions/exploring-spatial-data/m-p/501990#M39440</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;'Challenge' 1:&lt;/STRONG&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
arcpy.env.workspace = r'C:\Project\999999\myFGDB.gdb'&amp;nbsp; # example FileGeodatabase as workspace
arcpy.env.workspace = r'C:\Project\999999\mySHPfolder'&amp;nbsp; # example folder (with shapefiles) as workspace
fclasses = arcpy.ListFeatureClasses()

for fclass in fclasses:
&amp;nbsp;&amp;nbsp;&amp;nbsp; fctype = arcpy.Describe(fclass).shapeType
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "{0} is a {1} feature class".format(fclass, fctype)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;'Challenge' 2:&lt;/STRONG&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os
arcpy.env.workspace = r'C:\Project\999999\mySHPfolder'
fclasses = arcpy.ListFeatureClasses()

out_ws_all = r'C:\Project\999999\test_all.gdb'
out_ws_pol = r'C:\Project\999999\test_pol.gdb'

for fclass in fclasses:
&amp;nbsp;&amp;nbsp;&amp;nbsp; fctype = arcpy.Describe(fclass).shapeType
&amp;nbsp;&amp;nbsp;&amp;nbsp; newname = fclass
&amp;nbsp;&amp;nbsp;&amp;nbsp; if newname[-4:].upper() == ".SHP":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newname = newname[:-4] # trim the .shp extension from the name
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_fc = os.path.join(out_ws_all, fclass)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(fclass, out_fc)
&amp;nbsp;&amp;nbsp;&amp;nbsp; if fctype == 'Polygon':
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; out_fc = os.path.join(out_ws_pol, fclass)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(fclass, out_fc)&lt;/PRE&gt;&lt;BR /&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>Sat, 11 Dec 2021 22:01:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exploring-spatial-data/m-p/501990#M39440</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T22:01:57Z</dc:date>
    </item>
  </channel>
</rss>

