Fever, Here is a quick script I wrote to find the centroids based on the XY shape file. Please try and let me know how it works for you. dt = Current Data Table();
shapeList = Associative Array( Column( dt, "Shape ID" ) << get values ) << get keys;
dtCentroids = New Table("Centroids", New Column( "Shape ID", numeric, continuous ),
New Column( "X", numeric continuous ),
New Column( "Y", numeric, continuous )
);
For( i = 1, i <= N Items( shapeList ), i++,
targetRows = dt << get rows where( Column( dt, "Shape ID" )[Row()] == shapeList[i] );
centroid = Polygon Centroid( Column( dt, "X" )[targetRows], Column( dt, "Y" )[targetRows] );
dtCentroids << add rows( 1, "at end" );
Column( dtCentroids, "Shape ID" )[i] = i;
Column( dtCentroids, "X" )[i] = centroid[1];
Column( dtCentroids, "Y" )[i] = centroid[2];
);
... View more