text stringlengths 0 93.6k |
|---|
concavity = max(concavity,1) |
cmd = "lasboundary.exe" + \ |
" -i %s" % (inputs) + \ |
" -drop_x_below %s" % (str(10))+ \ |
" -concavity %s " % (str(concavity)) + \ |
" -epsg %s " % (str(epsg)) + \ |
" -cpu64 " + \ |
strcores + \ |
" -merged " + \ |
" -labels " + \ |
" -disjoint " + \ |
" -holes" + \ |
" -o %s" % (outfilename) |
# " -v" + \ |
stdout, stderr = runner(cmd, verbose) |
return outfilename |
############################################################################### |
# def lasboundary(filename, odir, nodata=0, resolution=1, prefix="", outfilename = "", extension="txt"): |
def lasboundary(filename, outfilename, nodata=0, resolution=1, replace=False): |
'''convert the laz file to a coverage shape file''' |
# odirlog = makedirs(os.path.dirname(outfilename)) |
# if len(outfilename) == 0: |
# root = os.path.splitext(os.path.basename(filename))[0] |
# #outfilename = os.path.join(odir, prefix + '_1band.txt') |
# outfilename = os.path.join(odir, prefix + root + '_boundary.'+ extension).replace('\\','/') |
#the file already exists and the user is not wanting to replace... |
if os.path.exists(outfilename) and replace == False: |
return outfilename |
cpu = getcpucount(0) |
strcores = " -cores %s" % (cpu) |
log("Processing with %d CPU's" %(cpu)) |
#lasboundary -i pk.laz -disjoint -o pkdisjoint.txt |
# concavity mwith a smaller number more closely follows the tif file |
# disjoint forces individual polygons rather than connecting lines. |
nodatamin = float(nodata) - 0.1 |
nodatamax = float(nodata) + 0.1 |
resolution = float(resolution) * 1.5 |
cmd = "lasboundary.exe" + \ |
" -i %s" % (os.path.abspath(filename).replace('\\','/')) + \ |
" -drop_x_below %s" % (str(10))+ \ |
" -concavity %s " % (str(resolution)) + \ |
" -cpu64 " + \ |
strcores + \ |
" -v" + \ |
" -disjoint " + \ |
" -drop_z %s %s" % (str(nodatamin), str(nodatamax)) + \ |
" -o %s" % (outfilename.replace('\\','/')) |
stdout, stderr = runner(cmd, False) |
return outfilename |
############################################################################### |
def lasoverlap(filename1, filename2, odir, resolution=1, prefix=""): |
'''compute the overlap between 2 files''' |
odirlog = makedirs(odir) |
filename1 = os.path.abspath(filename1).replace('\\','/') |
filename2 = os.path.abspath(filename2).replace('\\','/') |
root1 = os.path.splitext(os.path.basename(filename1))[0] |
root2 = os.path.splitext(os.path.basename(filename2))[0] |
outfilename = os.path.join(odir, prefix + "_" + root1 + "_" + root2 + '.laz') |
outfilename = outfilename.replace('\\','/') |
cmd = "lasoverlap64.exe" + \ |
" -i %s %s" % (filename1, filename2) + \ |
" -drop_x_below %s" % (str(10))+ \ |
" -values " + \ |
" -faf " + \ |
" -no_over " + \ |
" -o %s" % (outfilename) |
stdout, stderr = runner(cmd, False) |
return outfilename |
############################################################################### |
def las2lasEPSG(filename, odir="", epsg="4326"): |
'''apply EPSG code to a las file''' |
filename = os.path.abspath(filename).replace('\\','/') |
root = os.path.splitext(os.path.basename(filename))[0] |
outfilename = os.path.join(odir, root + "_EPSG_" + epsg + '.laz') |
outfilename = outfilename.replace('\\','/') |
outfilename = os.path.join(os.path.dirname(filename), root + ".laz") |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.