lasmergewrapper.ps1

This commit is contained in:
zwnk 2019-11-14 13:53:10 +01:00
parent 76aca42143
commit fe579e0545
1 changed files with 55 additions and 0 deletions

55
lasmerge_wrapper.ps1 Normal file
View File

@ -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!"