text
stringlengths
1
93.6k
if rebuild == False:
indexfiles = fileutils.findFiles2(False, odir, "*.lax")
if len(indexfiles) > 0:
return
odirlog = makedirs(odir)
cpu = getcpucount(0)
strcores = " -cores %s" % (cpu)
# log("Indexing with %d CPU's" %(cpu))
cmd = "lasindex.exe" + \
" -i %s" % (inputs) + \
strcores
stdout, stderr = runner(cmd, False)
return [stdout, stderr]
###############################################################################
def lastile(inputs, odir, tile_size=5000, prefix="", rebuild=False, verbose=False):
'''tile the laz files to a regular grids so we can scale indefinitely'''
inputs = os.path.abspath(inputs).replace('\\','/')+"/*.laz"
log('Tile the laz files to a regular grids so we can scale indefinitely')
#check to see if we really need to rebuild
# if rebuild == True:
# files = fileutils.findFiles2(False, odir, "*.laz")
# ds.deletefolder(odir)
# else:
# if len(files) > 0:
# #files exist so quit
# return odir
# starttime = time.time()
# odirlog = makedirs(odir)
cpu = getcpucount(0)
strcores = " -cores %s" % (cpu)
strcores = " -cores 4" # pkpk
log("Tiling %s with %d CPU's" %(inputs, cpu))
cmd = "lastile.exe" + \
" -i %s" % (inputs) + \
" -cpu64 " + \
strcores + \
" -v" + \
" -drop_x_below %s" % (str(10))+ \
" -tile_size %s " % (str(tile_size)) + \
" -olaz " + \
" -odir %s" % (odir)
# " -reversible " + \
stdout, stderr = runner(cmd, verbose)
# log("Tile Elapsed time: %.1f seconds" %(float(time.time() - starttime)), True)
return odir
###############################################################################
def lasthin(filename, odir, resolution=1, fill=0, epsg='4326', prefix=""):
'''convert the laz file to a coverage shp file'''
odirlog = makedirs(odir)
root, ext = os.path.splitext(os.path.basename(filename))
#outfilename = os.path.join(odir, prefix + '_1band.txt')
outfilename = os.path.join(odir, prefix + root + '_thin'+ ext).replace('\\','/')
resolution = float(resolution) * 3
cmd = "lasthin64.exe" + \
" -i %s" % (filename) + \
" -step %s " % (str(resolution)) + \
" -o %s" % (outfilename)
stdout, stderr = runner(cmd, False)
return outfilename
###############################################################################
def lasboundaries(inputs, odir, resolution=1, fill=0, epsg='4326', prefix="", verbose=False):
'''convert the laz file to a coverage shp file'''
odirlog = makedirs(odir)
cpu = getcpucount(0)
strcores = " -cores %s" % (cpu)
# log("Processing with %d CPU's" %(cpu))
outfilename = os.path.join(odir, prefix + '_boundary.shp').replace('\\','/')
# concavity mwith a smaller number more closely follows the tif file
# disjoint forces individual polygons rather than connecting lines.
concavity = float(resolution) + float(fill)
concavity = float(fill)
concavity = float(resolution) + float(fill) + float(fill)
concavity = float(fill) + float(fill)