Updated README

This commit is contained in:
doinachiroiu 2020-09-23 18:35:19 +00:00
parent 0639b18cba
commit 7c52e77c85
3 changed files with 55 additions and 30 deletions

View File

@ -1,16 +1,16 @@
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.10)
@ -19,6 +19,11 @@ project(test CXX C)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
find_package(PNG REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(libpcre REQUIRED IMPORTED_TARGET libpcre)
#pkg_check_modules(libproj REQUIRED IMPORTED_TARGET libproj)
set(SAPI_ROOT "${PROJECT_SOURCE_DIR}/../.." CACHE PATH "Path to the Sandboxed API source tree")
# cmake .. -G Ninja -DSAPI_ROOT=$HOME/sapi_root
@ -32,12 +37,10 @@ add_subdirectory("${SAPI_ROOT}"
add_library(libgdal STATIC IMPORTED)
set_property(TARGET libgdal PROPERTY IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/lib/libgdal.a")
find_package(PNG REQUIRED)
target_link_libraries(libgdal INTERFACE
crypto expat jpeg
/usr/lib/x86_64-linux-gnu/libproj.so
/usr/lib/x86_64-linux-gnu/libpcre.so
PkgConfig::libpcre
/usr/lib/libproj.so
sqlite3 tiff z pthread m rt dl curl
PNG::PNG)
@ -51,7 +54,7 @@ add_sapi_library(gdal_sapi
INPUTS "/usr/include/gdal/gdal.h"
LIBRARY libgdal
LIBRARY_NAME gdal
LIBRARY_NAME GDAL
NAMESPACE ""
)

View File

@ -5,6 +5,26 @@ Build Tools: CMake/Ninja
OS: Linux
```
### For installing GDAL:
`sudo apt-get install python3.6-dev`
`sudo add-apt-repository ppa:ubuntugis/ppa && sudo apt update`
`sudo apt-get install gdal-bin`
`sudo apt-get install libgdal-dev`
### Dependencies:
PNG: `sudo apt-get install libpng-dev`
PCRE: `sudo apt-get install libpcre3 libpcre3-dev`
PROJ: `sudo apt-get install libproj-dev`
### Initializing GDAL submodule:
`git submodule add https://github.com/OSGeo/gdal/tree/master/gdal`
### For testing:
`mkdir build && cd build`
@ -12,13 +32,13 @@ OS: Linux
`ninja`
`./raster`
`./raster <your_absolute_tiff_file_path>`
## About the project
GDAL is a translator library for raster and vector
geospatial data format.
The project consist in rastering a GeoTIFF file format
using GDAL functionalities and sandboxed methods.
GDAL is a translator library for raster and vector
geospatial data format.
The project consist in rastering a GeoTIFF file format
using GDAL functionalities and sandboxed methods.
## Implementation

View File

@ -20,15 +20,13 @@
#include <fstream>
#include <iostream>
#include "gdal_sapi.sapi.h"
#include "gdal_sapi.sapi.h" // NOLINT(build/include)
#include "sandboxed_api/sandbox2/util/fileops.h"
class GdalSapiSandbox : public gdalSandbox {
class GdalSapiSandbox : public GDALSandbox {
public:
std::string filePath;
GdalSapiSandbox(std::string path)
: gdalSandbox(), filePath(std::move(path)) {}
: GDALSandbox(), file_path_(std::move(path)) {}
std::unique_ptr<sandbox2::Policy> ModifyPolicy(
sandbox2::PolicyBuilder*) override {
@ -52,16 +50,20 @@ class GdalSapiSandbox : public gdalSandbox {
__NR_ftruncate,
__NR_unlink,
})
.AddFile(filePath)
.AddFile(file_path_)
.BuildOrDie();
}
private:
std::string file_path_;
};
absl::Status GdalMain(std::string filename) {
// Reading GDALDataset from a (local, specific) file.
GdalSapiSandbox sandbox(filename);
SAPI_RETURN_IF_ERROR(sandbox.Init());
gdalApi api(&sandbox);
GDALApi api(&sandbox);
sapi::v::CStr s(filename.data());