Did some testing with exporting importing, now I’m able to export from OpenGrade the surveyed points from the Contour.txt file and upload into a design tool. The test here is with a “desktop survey” driving back and forth with the simulator and clicking the altitude up and down. Looks like this in optisurface:
Then for the sake of testing I just set the target to the mean of the altitude and bring that back to OpenGrade:
I just bluntly set -1 for the heading, lat/long etc. values that I didn’t need.
As for the offset values in the file, what’s the third number? Am I correct in my hunch that it’s the UTM zone? Are the headings etc. needed elsewhere in the code?
Here’s the python code:
#Here we read in the Contour.txt used in surveying the area
#Read offset for northing and easting from header, then read data into an array
import numpy as np
f = open(‘Contour.txt’,‘r’)
lines = f.readlines();
f.seek(0);
offset = tuple(map(int, lines[5].rsplit()[0].split(‘,’)))
n_points = int(lines[6].rsplit()[0])
data_in = np.transpose(np.loadtxt(f,delimiter=“,”,skiprows=7))
f.close()
#Move data out from the offset
easting = data_in[0]+offset[0];
northing = data_in[2]+offset[1];
altitude = data_in[3];
#Dump XYZ into a file to export into an earthworks planning tool
data_out = np.column_stack((easting,northing,altitude))
np.savetxt(‘export.xyz’,data_out,delimiter=‘,’,fmt=‘%10.5f’)
#Create empty column for filling the not needed data like long / lat etc.
empty_column = -1*np.ones(easting.size);
#Create a data array with target as the mean altitude for testing purposes
data_back = np.column_stack((easting-offset[0],empty_column,northing-offset[1],altitude,empty_column,empty_column,-np.mean(altitude)*empty_column,empty_column,empty_column))
#Save to a new contour file
g = open(‘Contour_edit.txt’,‘a’)
for i in range (0,7):
g.write(lines[i])
np.savetxt(g,data_back,delimiter=‘,’,fmt=‘%10.5f’)
g.close()