import arcgisscripting gp = arcgisscripting.create(9.3) print 'Geoprocessor initialised' circle_path = ur'c:/test/circles.shp' cursor = gp.SearchCursor(circle_path) center_points = list() # let's iterate over all rows in the circle shape for row in iter(cursor.next, None): # get the circle polygon circle = row.shape # get xmin, xmax etc. x_min = circle.extent.XMin y_min = circle.extent.YMin x_max = circle.extent.XMax y_max = circle.extent.YMax center_x = x_max - x_min center_y = y_max - y_min center_points.append((center_x, center_y)) print center_points
import arcpy polygonfc = 'c:\temp\fgdb.gdb\studyarea' rows = arcpy.SearchCursor(polygonfc) for row in rows: feat = row.getValue('SHAPE') centroid = feat.centroid print centroid
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.