In my current project, I am grabbing data from a web service and want to change the projection before inserting into a production db. For some reason when I am projecting the data, some of it is being lost. The point feature class is being projected just fine, but the polygon feature class created after calling arcpy.Project_management has no data in it. I've created sample code of the issue and hope somebody can shed some light.
import arcpy import os # scratch gdb and 2 feature classes (these are WGS84) scratch_gdb = os.path.join("C:\\", "temporary", "scratch.gdb") original_points = os.path.join(scratch_gdb, "original_points") original_polys = os.path.join(scratch_gdb, "original_polys") # remove rows from our feature classes arcpy.DeleteRows_management(original_points) arcpy.DeleteRows_management(original_polys) # add a point to the point feature class point = arcpy.Point(-80.247928, 33.464786) cursor = arcpy.da.InsertCursor(original_points, ['SHAPE@XY']) cursor.insertRow([point]) # add a polygon to the polygon feature class polyarray = arcpy.Array([arcpy.Point(-80.254769, 33.467541), arcpy.Point(-80.239318, 33.468623), arcpy.Point(-80.236017, 33.456030), arcpy.Point(-80.264083, 33.451404)]) polygon = arcpy.Polygon(polyarray) cursor = arcpy.da.InsertCursor(original_polys, ['SHAPE@']) cursor.insertRow([polygon]) # at this point, both original_points and original_polys have data # create path for 2 temporary feature classes projected_points = os.path.join(scratch_gdb, "projected_points") projected_polys = os.path.join(scratch_gdb, "projected_polys") # delete these feature classes if they exist (from previously running the script) if(arcpy.Exists(projected_points)): arcpy.Delete_management(projected_points) if(arcpy.Exists(projected_polys)): arcpy.Delete_management(projected_polys) # project our 2 old feature classes into our 2 new feature classes sr = arcpy.SpatialReference(2273) arcpy.Project_management(original_points, projected_points, sr) arcpy.Project_management(original_polys, projected_polys, sr) # projected_points has a point, but projected_polys has no rows ?