I developed a tool in 10.0 which contains a function that snaps points from a point feature class, one at a time, to local networks of lines. The tool worked fine until we upgraded to 10.1, but now fails at this function.
The problem appears when attempting to create a geometry object or shapefile from a PointGeometry object containing a single point. I've managed to replicate this issue using ESRI's sample code for the PointGeometry object as such:
Executing the above script generates an empty feature class (containing no points), while using 2 or more points in the pointList exexecutes successfully. Any idea what's happening here?
The problem appears when attempting to create a geometry object or shapefile from a PointGeometry object containing a single point. I've managed to replicate this issue using ESRI's sample code for the PointGeometry object as such:
Code:
# Modified from source code at: http://resources.arcgis.com/en/help/main/10.1/index.html#/PointGeometry/018z00000039000000/
import arcpy
# A list of coordinate pairs
#
pointList = [[3,5]] # Originally pointList = [[1,2],[3,5],[7,3]]
# Create an empty Point object
#
point = arcpy.Point()
# A list to hold the PointGeometry objects
#
pointGeometryList = []
# For each coordinate pair, populate the Point object and create
# a new PointGeometry
for pt in pointList:
point.X = pt[0]
point.Y = pt[1]
pointGeometry = arcpy.PointGeometry(point)
pointGeometryList.append(pointGeometry)
# Create a copy of the PointGeometry objects, by using pointGeometryList
# as input to the CopyFeatures tool.
#
arcpy.CopyFeatures_management(pointGeometryList, "c:/geometry/a.gdb/points")