Commit f13c8d6d authored by Ludvik Brodl's avatar Ludvik Brodl
Browse files

Removes compression of .tif files and fixes the issue of no z value in buildings file

parent a26efff7
......@@ -99,38 +99,6 @@ function filter_points() {
}
function grid() {
echo $1
echo $2
pointfile=$1
tiffile=$2
method=$3
layer="${pointfile%.*}"
old_IFS=$IFS
IFS="_"
read -a metadata <<<"$pointfile"
IFS=$old_IFS
ymin=$((${metadata[1]} * 100))
xmin=$((${metadata[2]} * 100))
tilesize=$(( ${metadata[3]} * 100 ))
ymax=$(($ymin + $tilesize))
xmax=$(($xmin + $tilesize))
ncells=$(( $tilesize / $CELLSIZE ))
if [ ! -f $tiffile ]; then
gdal_grid \
-a $method \
-zfield Z \
-l $layer \
-txe $xmin $xmax \
-tye $ymin $ymax \
-outsize $ncells $ncells \
-co COMPRESS=DEFLATE -co PREDICTOR=1 -co ZLEVEL=9 \
$pointfile $tiffile
fi
}
function grid_shape() {
pointfile=$1
tiffile=$2
......@@ -146,16 +114,22 @@ function grid_shape() {
if [ ! -f $tiffile ]; then
gdal_grid \
-a $method \
-zfield Z \
-zfield z \
-l $layer \
-txe $xmin $xmax \
-tye $ymin $ymax \
-outsize $ncells $ncells \
-co COMPRESS=DEFLATE -co PREDICTOR=1 -co ZLEVEL=9 \
$pointfile $tiffile || echo "No buildings found in the layer, moving on"
$pointfile $tiffile || (echo "No buildings found in the layer, redoing gdal_grid without zfield"; gdal_grid \
-a $method \
-l $layer \
-txe $xmin $xmax \
-tye $ymin $ymax \
-outsize $ncells $ncells \
$pointfile $tiffile)
fi
}
function get_meta() {
pointfile=$1
layer="${pointfile%.*}"
......@@ -296,6 +270,11 @@ if [ ! -f $UNCLASSIFIED_POINTS_IN_BUILDINGS_CSV ]; then
spatialite -header -csv -silent $sqlite < $UNCLASSIFIED_POINTS_IN_BUILDINGS_SQL > $UNCLASSIFIED_POINTS_IN_BUILDINGS_CSV
fi
#Crazy fix for when the the building layer is empty, creates an empty csv answer based on sodermanlands building files.
if [ ! -s $UNCLASSIFIED_POINTS_IN_BUILDINGS_CSV ]; then
echo 'ogc_fid,x,y,z,class,scan_angle,intensity,return_nr,GEOMETRY' > $UNCLASSIFIED_POINTS_IN_BUILDINGS_CSV
fi
csv2vrt $UNCLASSIFIED_POINTS_OUTSIDE_BUILDINGS_CSV $UNCLASSIFIED_POINTS_OUTSIDE_BUILDINGS_VRT
csv2vrt $UNCLASSIFIED_POINTS_IN_BUILDINGS_CSV $UNCLASSIFIED_POINTS_IN_BUILDINGS_VRT
......@@ -327,8 +306,8 @@ fi
gdalwarp roofs.tif roofs_corr.tif
# interpolate raster from dem points
if [ ! -f $dem ]; then
grid_shape $DEM_POINTS_OUTSIDE_BUILDINGS_SHAPE dem.tif $x1 $y1 $x2 $y2 $ncells "linear"
if [ ! -f dem.tif ]; then
grid_shape $DEM_POINTS_OUTSIDE_BUILDINGS_SHAPE dem.tif $x1 $y1 $x2 $y2 $ncells "invdistnn:radius=500:max_points=2"
fi
# fix for bug in gdal_grid causing rasters with strange orientation, that cannot be handled by gdal_calc.py
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment