Handle paths with spaces

pull/1283/head
Piero Toffanin 2021-05-17 13:25:52 -04:00
rodzic a2df616cc9
commit 9c551ba902
7 zmienionych plików z 24 dodań i 24 usunięć

Wyświetl plik

@ -148,7 +148,7 @@ class Cropper:
boundary_file_path = self.path('boundary.json')
run('pdal info --boundary --filters.hexbin.edge_size=1 --filters.hexbin.threshold=0 {0} > {1}'.format(decimated_pointcloud_path, boundary_file_path))
run('pdal info --boundary --filters.hexbin.edge_size=1 --filters.hexbin.threshold=0 "{0}" > "{1}"'.format(decimated_pointcloud_path, boundary_file_path))
pc_geojson_boundary_feature = None

Wyświetl plik

@ -52,7 +52,7 @@ def compute_cutline(orthophoto_file, crop_area_file, destination, max_concurrenc
system.run("gdal_translate -outsize {}% 0 "
"-co NUM_THREADS={} "
"--config GDAL_CACHEMAX {}% "
"{} {}".format(
'"{}" "{}"'.format(
scale * 100,
max_concurrency,
concurrency.get_max_memory(),

Wyświetl plik

@ -217,7 +217,7 @@ def create_dem(input_point_cloud, dem_type, output_type='max', radiuses=['0.56']
'-co NUM_THREADS={threads} '
'-co BIGTIFF=IF_SAFER '
'--config GDAL_CACHEMAX {max_memory}% '
'{tiles_vrt} {geotiff_tmp}'.format(**kwargs))
'"{tiles_vrt}" "{geotiff_tmp}"'.format(**kwargs))
# Scale to 10% size
run('gdal_translate '
@ -225,7 +225,7 @@ def create_dem(input_point_cloud, dem_type, output_type='max', radiuses=['0.56']
'-co BIGTIFF=IF_SAFER '
'--config GDAL_CACHEMAX {max_memory}% '
'-outsize 10% 0 '
'{geotiff_tmp} {geotiff_small}'.format(**kwargs))
'"{geotiff_tmp}" "{geotiff_small}"'.format(**kwargs))
# Fill scaled
gdal_fillnodata(['.',
@ -244,7 +244,7 @@ def create_dem(input_point_cloud, dem_type, output_type='max', radiuses=['0.56']
'-co BIGTIFF=IF_SAFER '
'-co COMPRESS=DEFLATE '
'--config GDAL_CACHEMAX {max_memory}% '
'{merged_vrt} {geotiff}'.format(**kwargs))
'"{merged_vrt}" "{geotiff}"'.format(**kwargs))
else:
run('gdal_translate '
'-co NUM_THREADS={threads} '
@ -252,7 +252,7 @@ def create_dem(input_point_cloud, dem_type, output_type='max', radiuses=['0.56']
'-co BIGTIFF=IF_SAFER '
'-co COMPRESS=DEFLATE '
'--config GDAL_CACHEMAX {max_memory}% '
'{tiles_vrt} {geotiff}'.format(**kwargs))
'"{tiles_vrt}" "{geotiff}"'.format(**kwargs))
if apply_smoothing:
median_smoothing(geotiff_path, output_path)

Wyświetl plik

@ -64,8 +64,8 @@ def dem_to_points(inGeotiff, outPointCloud, verbose=False):
'verbose': '-verbose' if verbose else ''
}
system.run('{bin} -inputFile {infile} '
'-outputFile {outfile} '
system.run('"{bin}" -inputFile "{infile}" '
'-outputFile "{outfile}" '
'-skirtHeightThreshold 1.5 '
'-skirtIncrements 0.2 '
'-skirtHeightCap 100 '
@ -99,8 +99,8 @@ def dem_to_mesh_gridded(inGeotiff, outMesh, maxVertexCount, verbose=False, maxCo
'maxConcurrency': maxConcurrency,
'verbose': '-verbose' if verbose else ''
}
system.run('{bin} -inputFile {infile} '
'-outputFile {outfile} '
system.run('"{bin}" -inputFile "{infile}" '
'-outputFile "{outfile}" '
'-maxTileLength 2000 '
'-maxVertexCount {maxVertexCount} '
'-maxConcurrency {maxConcurrency} '
@ -123,7 +123,7 @@ def dem_to_mesh_gridded(inGeotiff, outMesh, maxVertexCount, verbose=False, maxCo
'max_faces': maxVertexCount * 2
}
system.run('{reconstructmesh} -i "{infile}" '
system.run('"{reconstructmesh}" -i "{infile}" '
'-o "{outfile}" '
'--remove-spikes 0 --remove-spurious 0 --smooth 0 '
'--target-face-num {max_faces} '.format(**cleanupArgs))
@ -158,8 +158,8 @@ def screened_poisson_reconstruction(inPointCloud, outMesh, depth = 8, samples =
}
# Run PoissonRecon
system.run('{bin} --in {infile} '
'--out {outfile} '
system.run('"{bin}" --in "{infile}" '
'--out "{outfile}" '
'--depth {depth} '
'--pointWeight {pointWeight} '
'--samplesPerNode {samples} '
@ -171,11 +171,11 @@ def screened_poisson_reconstruction(inPointCloud, outMesh, depth = 8, samples =
cleanupArgs = {
'reconstructmesh': context.omvs_reconstructmesh_path,
'outfile': outMesh,
'infile': outMeshDirty,
'infile':outMeshDirty,
'max_faces': maxVertexCount * 2
}
system.run('{reconstructmesh} -i "{infile}" '
system.run('"{reconstructmesh}" -i "{infile}" '
'-o "{outfile}" '
'--remove-spikes 0 --remove-spurious 0 --smooth 0 '
'--target-face-num {max_faces} '.format(**cleanupArgs))

Wyświetl plik

@ -189,14 +189,14 @@ def get_extent(input_point_cloud):
# We know PLY files do not have --summary support
if input_point_cloud.lower().endswith(".ply"):
fallback = True
run('pdal info {0} > {1}'.format(input_point_cloud, json_file))
run('pdal info "{0}" > "{1}"'.format(input_point_cloud, json_file))
try:
if not fallback:
run('pdal info --summary {0} > {1}'.format(input_point_cloud, json_file))
run('pdal info --summary "{0}" > "{1}"'.format(input_point_cloud, json_file))
except:
fallback = True
run('pdal info {0} > {1}'.format(input_point_cloud, json_file))
run('pdal info "{0}" > "{1}"'.format(input_point_cloud, json_file))
bounds = {}
with open(json_file, 'r') as f:

Wyświetl plik

@ -105,7 +105,7 @@ class ODMMvsTexStage(types.ODM_Stage):
shutil.rmtree(mvs_tmp_dir)
# run texturing binary
system.run('{bin} {nvm_file} {model} {out_dir} '
system.run('"{bin}" "{nvm_file}" "{model}" "{out_dir}" '
'-d {dataTerm} -o {outlierRemovalType} '
'-t {toneMapping} '
'{intermediate} '
@ -113,7 +113,7 @@ class ODMMvsTexStage(types.ODM_Stage):
'{skipLocalSeamLeveling} '
'{keepUnseenFaces} '
'{nadirMode} '
'{labelingFile} '.format(**kwargs))
'"{labelingFile}" '.format(**kwargs))
# Backward compatibility: copy odm_textured_model_geo.mtl to odm_textured_model.mtl
# for certain older WebODM clients which expect a odm_textured_model.mtl

Wyświetl plik

@ -70,9 +70,9 @@ class ODMOrthoPhotoStage(types.ODM_Stage):
kwargs['models'] = ','.join(map(double_quote, models))
# run odm_orthophoto
system.run('{odm_ortho_bin} -inputFiles {models} '
'-logFile {log} -outputFile {ortho} -resolution {res} {verbose} '
'-outputCornerFile {corners} {bands}'.format(**kwargs))
system.run('"{odm_ortho_bin}" -inputFiles {models} '
'-logFile "{log}" -outputFile "{ortho}" -resolution {res} {verbose} '
'-outputCornerFile "{corners}" {bands}'.format(**kwargs))
# Create georeferenced GeoTiff
geotiffcreated = False
@ -114,7 +114,7 @@ class ODMOrthoPhotoStage(types.ODM_Stage):
'-a_srs \"{proj}\" '
'--config GDAL_CACHEMAX {max_memory}% '
'--config GDAL_TIFF_INTERNAL_MASK YES '
'{input} {output} > {log}'.format(**kwargs))
'"{input}" "{output}" > "{log}"'.format(**kwargs))
bounds_file_path = os.path.join(tree.odm_georeferencing, 'odm_georeferenced_model.bounds.gpkg')