Given two lat, lon coordinates, I'd like to output a file with intermediate coordinates at increments of 0.5 (say). So using the coordinates pair (38, 60) and (40, 62) as an example, I'd like to get:
Code:
38.00 60.00
38.00 60.50
38.00 61.00
38.00 61.50
38.00 62.00
38.50 60.00
38.50 60.50
38.50 61.00
38.50 61.50
38.50 62.00
39.00 60.00
39.00 60.50
39.00 61.00
39.00 61.50
39.00 62.00
39.50 60.00
39.50 60.50
39.50 61.00
39.50 61.50
39.50 62.00
40.00 60.00
40.00 60.50
40.00 61.00
40.00 61.50
40.00 62.00
(Blank lines are included here for ease of visibility)
Using the code snippet below, the lat variable (i) doesn't increment, and the program terminates giving just:
Code:
38.00 60.00
38.00 60.50
38.00 61.00
38.00 61.50
38.00 62.00
Code:
set lat1 = 38
set lat2 = 40
set lon1 = 60
set lon2 = 62
set increment = 0.5
awk 'BEGIN { i = '"$lat1"'; j = '"$lon1"'; while (i <= '"$lat2"') {while (j <= '"$lon2"') {printf "%5.2f %5.2f\n", i, j; j = j + '"$increment"'}; i = i + '"$increment"'}}'
Any help would be appreciated.