text stringlengths 0 93.6k |
|---|
# outfilename = os.path.join(os.path.dirname(filename), root + "_EPSG_" + epsg + ".laz") |
outfilename = outfilename.replace('\\','/') |
prefix = str(uuid.uuid1()) |
path = os.path.join(os.path.dirname(filename), prefix + ".laz") |
fileutils.copyfile(filename, path) |
cmd = "las2las64.exe" + \ |
" -i %s " % (path) + \ |
" -epsg %s " % (epsg) + \ |
" -o %s" % (outfilename) |
stdout, stderr = runner(cmd, False) |
fileutils.deletefile(path) |
return outfilename |
############################################################################### |
def las2las(filename, odir, zcorrection=0, suffix="_Z"): |
'''correct a laz file by adding a user supplied correction''' |
# odirlog = makedirs(odir) |
filename = os.path.abspath(filename).replace('\\','/') |
root = os.path.splitext(os.path.basename(filename))[0] |
outfilename = os.path.join(odir, root + suffix + '.laz') |
outfilename = outfilename.replace('\\','/') |
cmd = "las2las64.exe" + \ |
" -i %s " % (filename) + \ |
" -drop_x_below %s" % (str(10))+ \ |
" -translate_z %.3f " % (zcorrection) + \ |
" -o %s" % (outfilename) |
stdout, stderr = runner(cmd, False) |
return outfilename |
############################################################################### |
def las2lasclipstarttime(filename, outfilename, clipstarttime=0): |
'''correct a laz file by adding a user supplied correction''' |
# odirlog = makedirs(odir) |
filename = os.path.abspath(filename).replace('\\','/') |
outfilename = os.path.abspath(outfilename).replace('\\','/') |
cmd = "las2las64.exe" + \ |
" -i %s " % (filename) + \ |
" -drop_x_below %s" % (str(10))+ \ |
" -drop_gpstime_below %.3f " % (clipstarttime) + \ |
" -o %s" % (outfilename) |
stdout, stderr = runner(cmd, False) |
return outfilename |
############################################################################### |
def ispositivedepths(rect): |
if rect.minz > 0 or rect.maxz > 0: |
return True |
if rect.minz < 0 or rect.maxz < 0: |
return False |
############################################################################### |
def getlazfirstlast(filename, odir, prefix="las2txt"): |
'''get the laz first and last records as fast as possible''' |
'''las2txt -i CATHX_D2019-08-29T00-36-18-702Z_None_X0.laz -thin_with_grid 1 -stdout | more''' |
if not os.path.isdir(odir): |
os.makedirs(odir) |
outfilename = os.path.join(odir, prefix + '_info.txt') |
fstd = open(outfilename, 'w') |
cmd = "las2txt64.exe" + \ |
" -i %s" % (os.path.abspath(filename).replace('\\','/')) + \ |
" -o %s" % (os.path.abspath(outfilename).replace('\\','/')) + \ |
" -thin_with_grid 1" |
args = shlex.split(cmd) |
proc = subprocess.Popen(args, stdout=fstd, stderr=subprocess.PIPE) |
proc.wait() |
'''now extract the position informaiton ''' |
startx = 0 |
starty = 0 |
startz = 0 |
endx = 0 |
endy = 0 |
endz = 0 |
f = open(outfilename, 'r') |
for line in f: |
line = line.strip() |
words = line.split(" ") |
if startx == 0: |
startx = float(words[0]) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.