learningawk
Technical User
I have a data file of coordinates that need to be evaluated and reformated.
Here's a snippet of data from an input file.
>,T4N,R10W,S1,0017
-98.212145, 34.840612
-98.194615, 34.840651
-98.194553, 34.855014
-98.198131, 34.855031
-98.200526, 34.855012
-98.212111, 34.855093
-98.212145, 34.840612
>,T4N,R10W,S2,0017
-98.229935, 34.840660
-98.212145, 34.840612
-98.212111, 34.855093
-98.215713, 34.855103
-98.229883, 34.855026
-98.229935, 34.840660
etc.
I need to get 4 points that describe the min/max of the corners of the data and then repeat the first corner point as the last point in the reformated data. Some of the groups of data have more than 5 points but I only want the 4+last point repeated. The min max of the corner points need to be identified as a pair of original coordinate not of individual x or y min/max.
The output should look like this for the first group of points: xcord ycord T4N R10W 1 corner_id
IMPORTANT NOTE:
The first OUTPUT point is described as the upper right coordinate then clockwise point 2 is lower right, point 3 lower left, point 4 upper left and point 5 repeated as point 1
T4N,R10W,S1,0017
-98.194553 34.855014 T4N R10W 1 1
-98.194615 34.840651 T4N R10W 1 2
-98.212145 34.840612 T4N R10W 1 3
-98.212111 34.855093 T4N R10W 1 4
-98.194553 34.855014 T4N R10W 1 5
The road block I am up against is how to get the individual xy pairs assigned to the 4 corner points.
Thank you for helping solve this.
Here's a snippet of data from an input file.
>,T4N,R10W,S1,0017
-98.212145, 34.840612
-98.194615, 34.840651
-98.194553, 34.855014
-98.198131, 34.855031
-98.200526, 34.855012
-98.212111, 34.855093
-98.212145, 34.840612
>,T4N,R10W,S2,0017
-98.229935, 34.840660
-98.212145, 34.840612
-98.212111, 34.855093
-98.215713, 34.855103
-98.229883, 34.855026
-98.229935, 34.840660
etc.
I need to get 4 points that describe the min/max of the corners of the data and then repeat the first corner point as the last point in the reformated data. Some of the groups of data have more than 5 points but I only want the 4+last point repeated. The min max of the corner points need to be identified as a pair of original coordinate not of individual x or y min/max.
The output should look like this for the first group of points: xcord ycord T4N R10W 1 corner_id
IMPORTANT NOTE:
The first OUTPUT point is described as the upper right coordinate then clockwise point 2 is lower right, point 3 lower left, point 4 upper left and point 5 repeated as point 1
T4N,R10W,S1,0017
-98.194553 34.855014 T4N R10W 1 1
-98.194615 34.840651 T4N R10W 1 2
-98.212145 34.840612 T4N R10W 1 3
-98.212111 34.855093 T4N R10W 1 4
-98.194553 34.855014 T4N R10W 1 5
The road block I am up against is how to get the individual xy pairs assigned to the 4 corner points.
Thank you for helping solve this.