InsertCursor in ArcGIS Pro doesn't understand my coordinates
I don't really work in ArcGIS, but from a general GIS perspective it looks as if you may be entering coordinates in a different coordinate system to that used by the map window. Have you checked that your input coordinates use the same system as that of the map window?
Those coordinates (3.3, 48) are mapped correctly using WGS84, where are you expecting them to map to?
I think that when you create a point through arcpy.Point({x},{y})
one should use SHAPE@
, not SHAPE@XY
in your cursor:
InsertCursor - help:
SHAPE@XY —A tuple of the feature's centroid x,y coordinates.
SHAPE@ —A geometry object for the feature.
Try adjusting that field in your cursor, that's how I'm inserting points in my script.
If that doesn't work, try setting your X and Y as a string
, that's how I'm using them inside arcpy.Point({x},{y})
.
When using SHAPE@
token the cursor is expecting a geometry. You are creating this with arcpy.Point
:
import arcpy
pointfc = r'C:\TEST.gdb\point'
a = [arcpy.Point(5,7)]
cursor = arcpy.da.InsertCursor(pointfc, ['SHAPE@'])
cursor.insertRow(a)
del cursor
If you want to use the SHAPE@XY token the cursor is expecting a tuple, for example (5,7)
:
import arcpy
pointfc = r'C:\TEST.gdb\point'
a = (5,7)
cursor = arcpy.da.InsertCursor(pointfc, ['SHAPE@XY'])
cursor.insertRow((a,))
del cursor