I am taking my first Python and and it's all online and I am struggle to say the list. I have watched videos and read blogs and I haven't been able to get the slightest idea of how to do this. I have a .gbd that has 4 feature class (shapefiles) in it. My first task was to write a script that read all the spatial reference and I got that
import arcpy
arcpy.env.workspace = "C:/Users/morganp/Documents/NOTES/msu/LM 7/GrPrg_lab7data"
feature_classes = arcpy.ListFeatureClasses()
for fc in feature_classes:
spatial_ref = arcpy.Describe(fc).spatialReference
if spatial_ref.name == "Unknown":
print("{} has an unknown spatial reference".format(fc))
else:
print("{} : {}".format(fc, spatial_ref.name))
My second task is to write a script that will set the one that has the unknown spatial reference to match the others
I am using IDLE Python 2.7 and ArcMap 10.7
Many thanks for all help
Perhaps the DefineProjection API will do the trick.
Thanks I actually found that page about 5 minutes after posting the question. Still working it out!!