Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. >>> import arcpy
  2. ... import os
  3. ... arcpy.env.workspace = "G:/Verizon_OneFiber/Data/Internal/utility georefs/MuniProvidedShapefiles/Plainfield/W135thStCopydata.gdb"
  4. ... arcpy.env.overwriteOutput = True
  5. ... outWorkspace = "G:/Verizon_OneFiber/Data/Internal/utility georefs/MuniProvidedShapefiles/Plainfield/W135thStCopy/data_WebMerc.gdb"
  6. ... try:
  7. ... for infc in arcpy.ListFeatureClasses():
  8. ... dsc = arcpy.Describe(infc)
  9. ...
  10. ... if dsc.spatialReference.Name == "Unknown":
  11. ... print ('skipped this fc due to undefined coord sys: ')
  12. ... print (infc)
  13. ...
  14. ... else:
  15. ... #Determine the new outpurt feature class
  16. ... outfc = os.path.join(outWorkspace, infc)
  17. ...
  18. ... #Set output coord sys
  19. ... outCS = arcpy.SpatialReference('WGS 1984 Web Mercator Auxiliary Sphere')
  20. ... break
  21. ... #Run project tool
  22. ... arcpy.Project_management(infc, outfc, outCS)
  23. ...
  24. ... #Check messages
  25. ... print(arcpy.GetMessages())
  26. ...
  27. ... except arcpy.ExecuteError:
  28. ... print(arcpy.GetMessages(2))
  29. ...
  30. ... except Exception as ex:
  31. ... print(ex.args[0])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement