sr = arcpy.SpatialReference(factoryCode)Where factoryCode is the WKID (well-known ID), that isn't so well known (just a small joke there, sorry). Maybe wrong, but this may set if correctly for you:sr = arcpy.SpatialReference(104145)
# Process: Make XY Event Layer, WKID 4267 is NAD 1927 in 10.1 arcpy.MakeXYEventLayer_management(tbl, "SURFACE_LONGITUDE", "SURFACE_LATITUDE", lyr, 4267)
#Import arcpy module import arcpy, os # Set the workspace environment to local file geodatabase arcpy.env.workspace = ws = r"C:\FoB Oil and Gas\GoM\WorkSpace.gdb" spa_ref = r'C:\Program Files (x86)\ArcGIS\Desktop10.0\Coordinate Systems\Geographic Coordinate Systems\North America\NAD 1927.prj' try: # Local variables: tbl = r"C:\FoB Oil and Gas\GoM\3_Compare\Compare.mdb\WELLS" lyr = "WELLS_Layer" # Process: Make XY Event Layer arcpy.MakeXYEventLayer_management(tbl, "SURFACE_LONGITUDE", "SURFACE_LATITUDE", lyr, spa_ref) # Print the total rows print arcpy.GetCount_management(lyr) arcpy.FeatureClassToFeatureClass_conversion(lyr, ws, 'WELLS_Points') print 'Created Feature Class' except: tb = sys.exc_info()[2] tbinfo = traceback.format_tb(tb)[0] pymsg = "PYTHON ERRORS:\nTraceback Info:\n" + tbinfo + "\nError Info:\n\t" + \ str(sys.exc_type) + ": " + str(sys.exc_value) + "\n" msgs = "ARCPY ERRORS:\n" + arcpy.GetMessages(2) + "\n" arcpy.AddError(msgs) arcpy.AddError(pymsg) print msgs print pymsg arcpy.AddMessage(arcpy.GetMessages(1)) print arcpy.GetMessages(1)
# Import arcpy module import arcpy # Set the workspace environment to local file geodatabase arcpy.env.workspace = r"C:\FoB Oil and Gas\GoM\WorkSpace.gdb" try: # Local variables: tbl = "C:\\FoB Oil and Gas\\GoM\\3_Compare\\Compare.mdb\\WELLS" lyr = "WELLS_Layer" # Process: Make XY Event Layer arcpy.MakeXYEventLayer_management(tbl, "SURFACE_LONGITUDE", "SURFACE_LATITUDE", lyr, "", "") # Print the total rows print arcpy.GetCount_management(lyr) except: print arcpy.GetMessages()
# Import arcpy module import arcpy # Set the workspace environment to local file geodatabase arcpy.env.workspace = r"C:\FoB Oil and Gas\GoM\WorkSpace.gdb" try: # Local variables: WELLS_1 = "C:\\FoB Oil and Gas\\GoM\\GOM_Spatial.mdb\\WELLS" tbl = "C:\\FoB Oil and Gas\\GoM\\3_Compare\\Compare.mdb\\WELLS" lyr = "WELLS_Layer" # Set the spatial reference spRef = r"Coordinate Systems\Geographic Coordinate Systems\North America\GCS_North_American_1927.prj" # Process: Make XY Event Layer arcpy.MakeXYEventLayer_management(tbl, "SURFACE_LONGITUDE", "SURFACE_LATITUDE", lyr, spRef, "") # Print the total rows print arcpy.GetCount_management(lyr) except: print arcpy.GetMessages()
It's a direct export from the model built.
# -*- coding: utf-8 -*- # --------------------------------------------------------------------------- # a.py # Created on: 2013-01-21 15:09:24.00000 # (generated by ArcGIS/ModelBuilder) # Description: # --------------------------------------------------------------------------- # Import arcpy module import arcpy # Local variables: WELLS__2_ = "C:\\FoB Oil and Gas\\GoM\\GOM_Spatial.mdb\\WELLS" WELLS__3_ = "C:\\FoB Oil and Gas\\GoM\\GOM_Spatial.mdb\\WELLS" WELLS__4_ = "C:\\FoB Oil and Gas\\GoM\\3_Compare\\Compare.mdb\\WELLS" WELLS_Layer = "WELLS_Layer" # Process: Make XY Event Layer arcpy.MakeXYEventLayer_management(WELLS__4_, "SURFACE_LONGITUDE", "SURFACE_LATITUDE", WELLS_Layer, "GEOGCS['GCS_North_American_1927',DATUM['D_North_American_1927',SPHEROID['Clarke_1866',6378206.4,294.9786982]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]];-400 -400 1000000000;-100000 10000;-100000 10000;8.98305509728916E-09;0.001;0.001;IsHighPrecision", "") # Process: Feature Class to Feature Class arcpy.FeatureClassToFeatureClass_conversion(WELLS_Layer, WELLS__3_, "Wells_Spatial", "", "API \"API\" true true false 12 Text 0 0 ,First,#,,API,-1,-1;WELL_NAME \"WELL_NAME\" true true false 255 Text 0 0 ,First,#,,WELL_NAME,-1,-1;WELL_NAME_SUFFIX \"WELL_NAME_SUFFIX\" true true false 8 Text 0 0 ,First,#,,WELL_NAME_SUFFIX,-1,-1;OPERATOR \"OPERATOR\" true true false 75 Text 0 0 ,First,#,,OPERATOR,-1,-1;BOTTOM_FIELD_NAME_CODE \"BOTTOM_FIELD_NAME_CODE\" true true false 8 Text 0 0 ,First,#,,BOTTOM_FIELD_NAME_CODE,-1,-1;SPUD_DATE \"SPUD_DATE\" true true false 255 Text 0 0 ,First,#,,SPUD_DATE,-1,-1;BOTTOM_LEASE_NUMBER \"BOTTOM_LEASE_NUMBER\" true true false 10 Text 0 0 ,First,#,,BOTTOM_LEASE_NUMBER,-1,-1;RKB_ELEVATION \"RKB_ELEVATION\" true true false 8 Double 0 0 ,First,#,,RKB_ELEVATION,-1,-1;BH_TOTAL_MD \"BH_TOTAL_MD\" true true false 8 Double 0 0 ,First,#,,BH_TOTAL_MD,-1,-1;TVD \"TVD\" true true false 8 Double 0 0 ,First,#,,TVD,-1,-1;SURFACE_NS_DISTANCE \"SURFACE_NS_DISTANCE\" true true false 8 Double 0 0 ,First,#,,SURFACE_NS_DISTANCE,-1,-1;SURFACE_NS_CODE \"SURFACE_NS_CODE\" true true false 1 Text 0 0 ,First,#,,SURFACE_NS_CODE,-1,-1;SURFACE_EW_DISTANCE \"SURFACE_EW_DISTANCE\" true true false 8 Double 0 0 ,First,#,,SURFACE_EW_DISTANCE,-1,-1;SURFACE_EW_CODE \"SURFACE_EW_CODE\" true true false 1 Text 0 0 ,First,#,,SURFACE_EW_CODE,-1,-1;SURFACE_BLOCK_NAME \"SURFACE_BLOCK_NAME\" true true false 255 Text 0 0 ,First,#,,SURFACE_BLOCK_NAME,-1,-1;BOTTOM_NS_DISTANCE \"BOTTOM_NS_DISTANCE\" true true false 8 Double 0 0 ,First,#,,BOTTOM_NS_DISTANCE,-1,-1;BOTTOM_NS_CODE \"BOTTOM_NS_CODE\" true true false 1 Text 0 0 ,First,#,,BOTTOM_NS_CODE,-1,-1;BOTTOM_EW_DISTANCE \"BOTTOM_EW_DISTANCE\" true true false 8 Double 0 0 ,First,#,,BOTTOM_EW_DISTANCE,-1,-1;BOTTOM_EW_CODE \"BOTTOM_EW_CODE\" true true false 1 Text 0 0 ,First,#,,BOTTOM_EW_CODE,-1,-1;BOTTOM_BLOCK_NAME \"BOTTOM_BLOCK_NAME\" true true false 255 Text 0 0 ,First,#,,BOTTOM_BLOCK_NAME,-1,-1;TOTAL_DEPTH_DATE \"TOTAL_DEPTH_DATE\" true true false 255 Text 0 0 ,First,#,,TOTAL_DEPTH_DATE,-1,-1;STATUS_DATE \"STATUS_DATE\" true true false 255 Text 0 0 ,First,#,,STATUS_DATE,-1,-1;TYPE_CODE \"TYPE_CODE\" true true false 1 Text 0 0 ,First,#,,TYPE_CODE,-1,-1;DISTRICT_CODE \"DISTRICT_CODE\" true true false 2 Text 0 0 ,First,#,,DISTRICT_CODE,-1,-1;STATUS_CODE \"STATUS_CODE\" true true false 3 Text 0 0 ,First,#,,STATUS_CODE,-1,-1;WATER_DEPTH \"WATER_DEPTH\" true true false 8 Double 0 0 ,First,#,,WATER_DEPTH,-1,-1;SURFACE_LONGITUDE \"SURFACE_LONGITUDE\" true true false 8 Double 0 0 ,First,#,,SURFACE_LONGITUDE,-1,-1;SURFACE_LATITUDE \"SURFACE_LATITUDE\" true true false 8 Double 0 0 ,First,#,,SURFACE_LATITUDE,-1,-1;BOTTOM_LONGITUDE \"BOTTOM_LONGITUDE\" true true false 8 Double 0 0 ,First,#,,BOTTOM_LONGITUDE,-1,-1;BOTTOM_LATITUDE \"BOTTOM_LATITUDE\" true true false 8 Double 0 0 ,First,#,,BOTTOM_LATITUDE,-1,-1;SURFACE_LEASE_NUMBER \"SURFACE_LEASE_NUMBER\" true true false 255 Text 0 0 ,First,#,,SURFACE_LEASE_NUMBER,-1,-1", "")
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.