to get it into row format
p
array([('Polygon_1', 0., 0.), ('Polygon_1', 10., 0.),
('Polygon_1', 10., 10.), ('Polygon_1', 10., 0.),
('Polygon_1', 0., 10.), ('Polygon_2', 10., 10.),
('Polygon_2', 20., 10.), ('Polygon_2', 20., 20.),
('Polygon_2', 20., 10.), ('Polygon_2', 10., 20.)],
dtype=[('P_id', '<U15'), ('y', '<f8'), ('x', '<f8')])
ID, Y, X = p.dtype.names
polys = np.unique(p[names[0]])
out = []
for poly in polys:
rows = p[np.where(p[ID] == poly)[0]]
ys = rows[Y]
xs = rows[X]
out.append((poly, *list(zip(ys,xs))))
ID, Y, X
polys
out
[('Polygon_1', (0.0, 0.0), (10.0, 0.0), (10.0, 10.0), (10.0, 0.0), (0.0, 10.0)), ('Polygon_2', (10.0, 10.0), (20.0, 10.0), (20.0, 20.0), (20.0, 10.0), (10.0, 20.0))]
Liesi, this can at least get your started... there are other ways of getting the geometry in many forms
The output format can obviously be changed.
The key is to use the structured array format that would come from FeatureclassToNumPyArray.
You need a key id field, which identifies which polygon is what,
then you query on that id (row 15... yes you need the [0] since a tuple is returned
pull out the ys, and xs using their appropriate field names
name some output container to store the bits zipping the ys,xs to form pairs
decide on your output format