text
stringlengths 1
93.6k
|
|---|
starty = float(words[1])
|
startz = float(words[2])
|
endx = float(words[0])
|
endy = float(words[1])
|
endz = float(words[2])
|
return startx, starty, startz, endx, endy, endz
|
###############################################################################
|
def getlazmeandepth(filename, odir, prefix="lasinfo"):
|
'''get the laz metadata mean depth'''
|
'''lasinfo -i lidar.laz -o _info -otxt -histo z 1'''
|
if not os.path.isdir(odir):
|
os.makedirs(odir)
|
prefix = str(uuid.uuid1())
|
outfilename = os.path.join(odir, prefix + '_infomd.txt').replace('\\','/')
|
fstd = open(outfilename, 'w')
|
cmd = "lasinfo64.exe" + \
|
" -i %s" % (os.path.abspath(filename).replace('\\','/')) + \
|
" -o %s" % (os.path.abspath(outfilename).replace('\\','/')) + \
|
" -nv" + \
|
" -histo z 1 "
|
args = shlex.split(cmd)
|
proc = subprocess.Popen(args, stdout=fstd, stderr=subprocess.PIPE)
|
proc.wait()
|
fstd.close()
|
'''now extract the position information '''
|
#point data format: 0
|
meanz = 0
|
recordcount = 0
|
f = open(outfilename, 'r')
|
for line in f:
|
if line.lstrip().lower().startswith('number of point records'):
|
line = line.lstrip()
|
line = line.rstrip()
|
line = line.replace("(", "")
|
line = line.replace(")", "")
|
line = line.replace(" ", " ")
|
line = line.replace(" ", " ")
|
line = line.replace(" ", " ")
|
line = line.replace(" ", " ")
|
line = line.replace(" ", " ")
|
line = line.replace(" ", " ")
|
line = line.replace(" ", " ")
|
line = line.replace(" ", " ")
|
line = line.replace(",", "")
|
words = line.split(" ")
|
recordcount= float(words[4])
|
if recordcount == 0:
|
return meanz, recordcount
|
if line.lstrip().lower().startswith('average z'):
|
line = line.lstrip()
|
line = line.rstrip()
|
line = line.replace("(", "")
|
line = line.replace(")", "")
|
line = line.replace(" ", " ")
|
line = line.replace(" ", " ")
|
line = line.replace(" ", " ")
|
line = line.replace(" ", " ")
|
line = line.replace(" ", " ")
|
line = line.replace(" ", " ")
|
line = line.replace(" ", " ")
|
line = line.replace(" ", " ")
|
line = line.replace(",", "")
|
words = line.split(" ")
|
meanz= float(words[3])
|
f.close()
|
fileutils.deletefile(outfilename)
|
return meanz, recordcount
|
###############################################################################
|
def getlazboundingbox(filename, odir, prefix="lasinfo"):
|
'''get the laz metadata and return the bounding box rectangle'''
|
'''lasinfo -i lidar.laz -odix _info -otxt'''
|
x = 0
|
y = 0
|
if not os.path.isdir(odir):
|
os.makedirs(odir)
|
prefix = str(uuid.uuid1())
|
outfilename = os.path.join(odir, prefix + '_infobb.txt')
|
f = open(outfilename, 'w')
|
cmd = "lasinfo64.exe" + \
|
" -i %s" % (os.path.abspath(filename).replace('\\','/')) + \
|
" -o %s" % (os.path.abspath(outfilename).replace('\\','/')) + \
|
" -nv" + \
|
" -nc"
|
args = shlex.split(cmd)
|
proc = subprocess.Popen(args, stdout=f, stderr=subprocess.PIPE)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.