From fe579e05457fc48219612b7b4826a072175480b3 Mon Sep 17 00:00:00 2001 From: zwnk Date: Thu, 14 Nov 2019 13:53:10 +0100 Subject: [PATCH] lasmergewrapper.ps1 --- lasmerge_wrapper.ps1 | 55 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 lasmerge_wrapper.ps1 diff --git a/lasmerge_wrapper.ps1 b/lasmerge_wrapper.ps1 new file mode 100644 index 0000000..615b97d --- /dev/null +++ b/lasmerge_wrapper.ps1 @@ -0,0 +1,55 @@ +<# + This a small lasmerge wrapper. + Run it with: + PowerShell -NoProfile -ExecutionPolicy Bypass -file lasmerge_wrapper.ps1 "c:\path\to\ground" "c:\path\to\object" +#> + +param($lasFilePathGround, $lasFilePathObject); + +$lasmerge = 'lasmerge.exe' +Write-Host "Executing Post 27F Transformation" +Write-Host $lasFilePathGround +Write-Host $lasFilePathObject + +# loop over all laz files +$lasFilesObject = Get-ChildItem $lasFilePathObject\* -Include *.las, *.laz + +Get-ChildItem $lasFilePath\* -Include *.las, *.laz | + ForEach-Object { + $allArguments = "" + + # get filename with full path + $fileNameFullGround = $_.FullName + $fileNameFullObject = + Write-Host "Starting $fileNameFullGround" + + # generating output filename + $outputFilename = $_.Name.split(".la")[0] # will be used to match object file name + $outputFile = Join-Path $lasFilePathGround $outputFilename + $outputFile = Join-Path $outputFile "laz" + + # getting object las filename + Get-ChildItem $lasFilePathObject\* -Include *.las, *.laz | ForEach-Object { + if($_.Name -match $outputFilename){ + $fileNameObject = $_.FullName + } + } + + # setting up lasRotate arguments + $allArguments += @(" -i " + $fileNameFullGround) + $allArguments += @(" -i " + $fileNameObject) + $allArguments += @(" -o " + $outputFile) + $allArguments += @(" -v") + + Write-Host "Executing ..." + $Command = $allArguments -join ' ' + + Try{ + $Process = Start-Process -FilePath $lasmerge -ArgumentList $allArguments -Wait #-ArgumentList "$allArguments" -Wait + } + Catch{ + Write-Host "Failed with files " $allArguments + Continue + } + } +Write-Host "All Done!" \ No newline at end of file