Solved! Go to Solution.
spRef = r("GCS_WGS_1984")spRef = arcpy.SpatialReference("WGS 1984")env.workspace = r"C:\Users\mbs7038\Documents\ArcGIS\matDEM"
arcpy.CopyFeatures_management(saved_Layer, "ElevPts.shp")
import arcpy
from arcpy import env
# Set environment settings
env.workspace = r"C:\Users\mbs7038\Documents\ArcGIS\matDEM"
try:
# Set the local variables
in_Table = "LatLonElev.txt"
x_coords = "Lon"
y_coords = "Lat"
z_coords = "Elev"
out_Layer = "ElevPts_layer"
saved_Layer = "ElevPts.lyr"
# Set the spatial reference
spRef = r("GCS_WGS_1984")
# Make the XY event layer
arcpy.MakeXYEventLayer_management(in_Table, x_coords, y_coords, out_Layer, spRef, z_coords)
# Save to a layer file
arcpy.SaveToLayerFile_management(out_Layer, saved_Layer)
#===============================================================================
# Copy features to shapefile
arcpy.CopyFeatures_management(saved_Layer, "ElevPts.shp")
#===============================================================================
except:
# If an error occurred print the message to the screen
print arcpy.GetMessages()
spRef = r("GCS_WGS_1984")spRef = arcpy.SpatialReference("WGS 1984")