# Name: PlayTest.py
# Description: Project all shapefiles to NAD_1983_UTM_Zone_10N 
# Author:   Helen Myles

# Import system modules
import arcpy
import os
arcpy.env.overwriteOutput = True
#Get the input parameters for the Project tool
inFC = arcpy.GetParameterAsText(0)
outC = arcpy.GetParameterAsText(1)

# Sets the workspace environment to the targetFolder
env.workspace = "C:/WCGIS/GEOG485/Lesson2"

# Creates a list of all feature classes in the targetFolder variable
fcList = arcpy.ListFeatureClasses()

try:
      
    # Desribe feature class and get its spatial reference
    desc = arcpy.Describe(inFC)
    spatialRef = desc.SpatialReference
    
    # Print the spatial reference name
    print spatialRef.Name

    # Report a successful message
    arcpy.AddMessage ("This is a Bear!")

    #Loop function used to identify and convert non-matching projections to the desired projection
    for featureClass in featureClassList:

      #Identify the feature class projection in fcList

       #Compare the current feature class projection with the desired feature class projection(targetProjectionDataset)
       if featureClass.SpatialReference.Name!= spatialRef.Name:
           
          # Different feature class to currentprojection identified. Create the new feature class path and name variable (newFeatureClass)

          # takes the file name of the feature class, makes it a string, and add it to the list of all project featureclasses
          
          # Create the new feature class (with'.projected added to the new feature class name) with the desired feature class projection

    # Show a message that the new feature class(es) were created successfully
    arcpy.AddMessage("\n" + "The file(s)" + projectedFeatureClassess[:-2] + "have successfully been reprojected" +"\n")
    
               

except:
    # Report an error messages
    arcpy.AddMessage("This project is incomplete")
    #Report any error messages that the projection might have generated
    arcpy.AddMessage(arcpy.GetMessages())

 

