missing line

580
1
03-28-2020 01:37 PM
CNRFGN
by
New Contributor II

import arcpy

from arcpy import env

env.workspace = "C:/Data"

fc = "roads.shp"

cursor = arcpy.da.SearchCursor(fc, ["OID@", "SHAPE@"])

for row in cursor:

print ("Feature {0}: ".format(row[0]))

→ ------------------------------------------------------------------------------------------------------

← print ("{0}, {1}".format(point.X, point.Y))

0 Kudos
1 Reply
DanPatterson_Retired
MVP Emeritus

row[0] is the OID@ value

row[1] is the SHAPE@ value

hence

pnt = row[1]
print("{}, {}".format(pnt.centroid.X, pnt.centroid.Y))‍‍‍‍

but you just cant get the point coordinates directly, you have to get its centroid first