Hmm, I cannot see anything obviously wrong with your code so it might be something about your data.
Did you verify that your longValue and latValue variables contain what you would expect for example using a print statement?
Below is your code where the inserting uses the InsertCursor in the data access module (but haven't tested it). If you have ArcGIS 10.1 and above, try it.
Filip.
import arcpy
arcpy.env.overwriteOutput = True
out_path = r"M:\work\nettoc\MAS201300311\PythonModule\import_data"
pointFC = r"M:\work\nettoc\MAS201300311\PythonModule\import_data\POI.shp"
geoType = "POINT"
StructurePoints = open(r"M:\work\nettoc\MAS201300311\PythonModule\import_data\TEST2.txt", "r")
coordList = []
# Parse the exported text file and create a list that Python can read
# figure out position of the lat and long in the header
headerLine = StructurePoints.readline()
valueList = headerLine.split(",")
latValueIndex = valueList.index('"SURF_LATITUDE"')
longValueIndex = valueList.index('"SURF_LONGITUDE"')
planValueIndex = valueList.index('"PLAN"')
typeValueIndex = valueList.index('"PLAN_SITE_TYPE"')
ancRadiusValueIndex = valueList.index('"ANCHOR_RADIUS"')
# Read line in the file and append to coordinate list
for line in StructurePoints.readlines():
# need to say what the seperating value is, in this case its the ","
segmentedLine = line.split(",")
# only append the value (index) indicated... we could have used "segmentedline[2]", but if lat changes position in the header list
# we would have to change the index number.
coordList.append([segmentedLine[planValueIndex], segmentedLine[typeValueIndex], segmentedLine[ancRadiusValueIndex], segmentedLine[longValueIndex], segmentedLine[latValueIndex]])
# Loop and delete any existing features in the shapefile
rows = arcpy.UpdateCursor(pointFC)
for row in rows:
rows.deleteRow(row)
del rows, row
print "Prepairing shape file..."
# Loop through new created coordlist and insert the the points in the existing shape file
with arcpy.da.InsertCursor(pointFC, ["SHAPE@", "DESCR", "ANCHOR_RAD"]) as rowInserter:
#Loop through each coordinate in the list
for coordinate in coordList:
# Grab a set of coordinates from the list and assign them to a point obejct
longValue = float(coordinate[3])
latValue = float(coordinate[4])
pointGeometry = arcpy.Point(longValue,latValue)
descr = coordinate[0] + ", " + coordinate[1]
andchor_rad = coordinate[2]
newrow = [pointGeometry, descr, anchor_rad]
rowInserter.insertRow(newrow)
del rowInserter
print "The following points were created"
print coordList