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