lasmergewrapper.ps1
This commit is contained in:
parent
76aca42143
commit
fe579e0545
1 changed files with 55 additions and 0 deletions
55
lasmerge_wrapper.ps1
Normal file
55
lasmerge_wrapper.ps1
Normal 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!"
|
Loading…
Reference in a new issue