AnsweredAssumed Answered

Problem with adding points into a feature class with arcpy

Question asked by JALevine on Feb 17, 2017
Latest reply on Feb 21, 2017 by bixb0012


I'm trying to add a list of coordinates to a feature class in arcpy.  When I manually add each xy pair as graphics into arc map using the go to xy tool, the points show up where I expect them to:


However, when I use arcpy, they are slightly offset:


Here is the code I'm using:


import arcpy, json, ConversionUtils




coordinates = [
    [-118.3436607214932, 34.18465195557297],
    [-118.3437040116469, 34.18108463923645],
    [-118.338436218283, 34.18097397459129],
    [-118.3383716114292, 34.18454551218532],
    [-118.3421286432001, 34.18221218702963],
    [-118.3398871274149, 34.18236566520285]


feature_class = arcpy.CreateFeatureclass_management("in_memory", "temp_feature_class", "POINT")


cursor = arcpy.da.InsertCursor(feature_class, ['SHAPE@'])


points = []
for (x, y) in coordinates:
    points.append(arcpy.Point(x, y))


for point in points:
sr = arcpy.SpatialReference(4326)
arcpy.DefineProjection_management(feature_class, sr)
arcpy.FeatureClassToShapefile_conversion(feature_class, "C:/Temp")



Is anyone able to reproduce this problem, and if so, what is causing it and what can I do to fix it.