-
Notifications
You must be signed in to change notification settings - Fork 63
/
process_lidar.sh
executable file
·53 lines (42 loc) · 1.52 KB
/
process_lidar.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
# install nodejs and the liblas library to use this script:
#sudo apt-get install liblas-bin
# USAGE - process_lidar.sh <las file> <las image> <las split size in MB> <result dir> <lidar height adjust> <source EPSG>
lidar=$1
lidar_image=$2
split_size=$3
result_dir=$4
height_adjust=$5
epsg=$6
filename=$(basename $lidar .las)
result_dir=$result_dir/$filename
mkdir $result_dir
echo "splitting las file"
#rm tmp $result_dir $result_dir/tiles.txt -R >/dev/null 2>&1;mkdir -p tmp $result_dir
rm -r tmp >/dev/null 2>&1;mkdir -p tmp $result_dir
las2las --split-mb $split_size $lidar -o tmp/$filename
rename 's/\d+/sprintf("%04d",$&)/e' tmp/$filename-*
# process each file
for file in tmp/$filename-*.las; do
case=$(basename $file .las)
echo $case "- processing"
echo $case "- attaching color to file"
las2las -i $file \
--color-source $lidar_image \
--file-format 1.2 \
--point-format 3 \
-o tmp/c.las
# export the color
echo $case "- exporting color information"
las2txt -i tmp/c.las -o tmp/c.txt --parse RGB
# project the data
echo $case "- transforming las projection"
las2las --a_srs EPSG:$epsg --t_srs EPSG:4326 $file --scale 0.000001 0.000001 0.01 -o tmp/p.las
# output the points
echo $case "- exporting points"
las2txt -i tmp/p.las -o tmp/p.txt --parse xyz
# process the cesium data
node RTC.js tmp/p.txt tmp/c.txt $result_dir/$case $height_adjust
done
./make_tileset.sh $filename $result_dir
rm tmp -R