Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> import arcpy
- ... import os
- ... arcpy.env.workspace = "G:/Verizon_OneFiber/Data/Internal/utility georefs/MuniProvidedShapefiles/Plainfield/W135thStCopydata.gdb"
- ... arcpy.env.overwriteOutput = True
- ... outWorkspace = "G:/Verizon_OneFiber/Data/Internal/utility georefs/MuniProvidedShapefiles/Plainfield/W135thStCopy/data_WebMerc.gdb"
- ... try:
- ... for infc in arcpy.ListFeatureClasses():
- ... dsc = arcpy.Describe(infc)
- ...
- ... if dsc.spatialReference.Name == "Unknown":
- ... print ('skipped this fc due to undefined coord sys: ')
- ... print (infc)
- ...
- ... else:
- ... #Determine the new outpurt feature class
- ... outfc = os.path.join(outWorkspace, infc)
- ...
- ... #Set output coord sys
- ... outCS = arcpy.SpatialReference('WGS 1984 Web Mercator Auxiliary Sphere')
- ... break
- ... #Run project tool
- ... arcpy.Project_management(infc, outfc, outCS)
- ...
- ... #Check messages
- ... print(arcpy.GetMessages())
- ...
- ... except arcpy.ExecuteError:
- ... print(arcpy.GetMessages(2))
- ...
- ... except Exception as ex:
- ... print(ex.args[0])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement