***************************************************************************
Fill_empty_cells_by_interpolating_with_neighboring_values.txt
--------------------------------------
  Date                 : jul 2018
  Copyright            : © 2018 by CartoLAB
  Email 1              : darango at emapic dot com
  Email 2			   : luipir at gmail dot com
***************************************************************************
*																		  *
*	This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU General Public License as published	  *
* 	by the Free Software Foundation; either version 2 of the License, 	  *
*	or (at your option) any later version.								  *
*																		  *
***************************************************************************

// Estimated time to run this script: 
// PC: 4Gb RAM - Intel® Core™2 Quad CPU Q8200 @ 2.33GHz × 4

*********

These GDAL algorithms are used to fill the empty cells generated by the 
shadows in the Mobile Mapping System data and create a raster adapted to
the road (sidewalk and road). To do this, you must first have a raster 
mask containing the buildings (pixel values = 0) and the road (pixel 
values = 1). The three algorithms must be executed in a correlative way 
via command line.

Input files must be the raster created in scripts 5 and 6. 

Example of use for heights raster:

7.1- Fill the raster cells by gdal.fillnodata. 
(Output: Z_heights_filled.tif).
gdal_fillnodata.py -md 12 -b 1 -of GTiff <out_5_Z_heights.tif> <Z_heights_filled.tif>


7.2- Create a mask adapted to the study area by gdal_translate. 
Input coordinates are the corners ulx uly lrx lry of the study area 
(Z_heights_filled.tif). These coordinates can be seen in the properties 
of the raster layer in QGIS software.(Output: clipped_extent.tif)
gdal_translate -projwin 547284.875 4801507.66 547504.835 4801352.5 -ot 
Float32 -of GTiff <building_mask.tif>  <clipped_extent.tif>

7.3- Multiply Z_heights_filled.tif and clipped_extent.tif. (Output: masked_ground.tif)
gdal_calc --calc "A*B" --format GTiff --type Float32 --outfile <out_7_Z_height_masked_ground.tif> -A <Z_heights_filled.tif> --A_band 1 
-B <clipped_extent.tif> --B_band 1