1# GDAL Raster GeoTIFF Workflow 2 3``` 4Build Tools: CMake/Ninja 5OS: Linux 6``` 7 8### For installing GDAL: 9 10``` 11sudo apt-get install python3.6-dev 12sudo add-apt-repository ppa:ubuntugis/ppa && sudo apt update 13sudo apt-get install gdal-bin 14sudo apt-get install libgdal-dev 15``` 16 17### Dependencies: 18 19PNG: `sudo apt-get install libpng-dev` 20 21PCRE: `sudo apt-get install libpcre3 libpcre3-dev` 22 23PROJ: `sudo apt-get install libproj-dev` 24 25OBS! You may need to set `export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib`. 26It is required for libproj.so to be found into /usr/local/lib/. You can also fix 27this by typing `locate libproj.so` which will give you 28<the_absolute_libproj.so_path> and then `cp <the_absolute_libproj.so_path> 29/usr/local/lib/`. 30 31### Initializing GDAL submodule: 32 33`git submodule add https://github.com/OSGeo/gdal/tree/master/gdal` 34 35### Building GDAL statically 36 37GNUmakefile from gdal/gdal can handle building the static library. 38 39`cd gdal/gdal && make static-lib` 40 41`cd ../.. && mkdir lib` 42 43`cp gdal/gdal/libgdal.a lib/` 44 45OBS! The file is huge! It may take a while. 46 47### For testing: 48 49`mkdir build && cd build` 50 51`cmake .. -G Ninja` 52 53`ninja` 54 55`./raster <your_absolute_tiff_file_path>` 56 57## About the project 58 59GDAL is a translator library for raster and vector geospatial data format. The 60project consist in rastering a GeoTIFF file format using GDAL functionalities 61and sandboxed methods. 62 63## Implementation 64 65*Sandboxing...* 66 67The purpose of sandboxing is to limit the permissions and capabilities of 68library’s methods, in order to secure the usage of them. After obtaining the 69sandbox, the functions will be called through an Sandbox API (being called api 70in the current test) and so, the operations, system calls or namspaces access 71may be controlled. 72 73*Raster process...* 74 75Useful functions from the `gdal.h` header are added to the SAPI library built 76with CMake. 77 78One .tiff file is manipulated with GDALOpen functionality, which extracts a 79pointer to the data set containg a list of raster bands, all pertaining to the 80same area. Metadata, a coordinate system, a georeferencing transform, size of 81raster and various other information are kept into the data set that corresponds 82to the image. 83 84To create an array containing the image information, the dimentions needed are 85extracted using some specific GDAL(X/Y)Size functions applied to the block. 86GDALRasterBand function takes care of data type conversion, one more step 87following: placing the converted data (with RasterIO method) into the created 88and well allocated structure. 89