13 std::string connInfo(
"file://");
14 std::string data_dir = TERRALIB_DATA_DIR;
17 std::cout <<
"Inform the location of your tiff file (ENTER to accept default \'" << (data_dir +
"/geotiff/cbers2b_rgb342_crop.tif") <<
"\'): ";
18 std::getline (std::cin, aux);
22 connInfo += data_dir +
"/geotiff/cbers2b_rgb342_crop.tif";
25 std::cout <<
"Datasource is opened? " << std::boolalpha << dsGDAL->isOpened() <<
'\n' <<
'\n';
29 std::cout <<
"Datasource is opened? " << std::boolalpha << dsGDAL->isOpened() <<
'\n' <<
'\n';
30 std::cout <<
"Datasource is valid? " << std::boolalpha << dsGDAL->isValid() <<
'\n' <<
'\n';
32 if (!dsGDAL->isOpened() || !dsGDAL->isValid())
33 std::cout <<
"Datasource " << aux <<
" can not be used!\n";
37 catch(
const std::exception& e)
39 std::cout << std::endl <<
"An exception has occurred in GDALExample OpenFile(): " << e.what() << std::endl;
43 std::cout << std::endl <<
"An unexpected exception has occurred in GDALExample OpenFile()!" << std::endl;
52 std::string connInfo(
"file://");
53 std::string data_dir = TERRALIB_DATA_DIR;
56 std::cout <<
"Inform the location of your folder of images (ENTER to accept default \'" << (data_dir +
"/geotiff") <<
"\'): ";
57 std::getline (std::cin, aux);
61 connInfo += data_dir +
"/geotiff";
70 std::cout <<
"Datasource is opened? " << std::boolalpha << ds->isOpened() <<
'\n' <<
'\n';
71 std::cout <<
"Datasource is valid? " << std::boolalpha << ds->isValid() <<
'\n' <<
'\n';
73 if (!ds->isOpened() || !ds->isValid())
74 std::cout <<
"Datasource " << aux <<
" can not be used!\n";
80 catch(
const std::exception& e)
82 std::cout << std::endl <<
"An exception has occurred in GDALExample OpenDirectory(): " << e.what() << std::endl;
86 std::cout << std::endl <<
"An unexpected exception has occurred in GDALExample OpenDirectory()!" << std::endl;
96 std::string connInfo(
"file://");
97 std::string data_dir = TERRALIB_DATA_DIR;
100 std::cout <<
"Inform the location of your folder of images (ENTER to accept default \'" << (data_dir +
"/geotiff") <<
"\'): ";
101 std::getline (std::cin, aux);
105 connInfo += data_dir +
"/geotiff";
110 std::unique_ptr<te::da::DataSourceTransactor> tr = ds->getTransactor();
112 std::string dsName(
"cbers2b_rgb342_crop.tif");
113 if (tr->dataSetExists(dsName))
115 std::unique_ptr<te::da::DataSet> dtset = tr->getDataSet(
"cbers2b_rgb342_crop.tif");
119 catch(
const std::exception& e)
121 std::cout << std::endl <<
"An exception has occurred in GDALExample DataSourceTransactor(): " << e.what() << std::endl;
125 std::cout << std::endl <<
"An unexpected exception has occurred in GDALExample DataSourceTransactor()!" << std::endl;
void DataSourceTransactor()
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
void GDALExample()
An example using GDAL data source driver.
void PrintDataSets(te::da::DataSource *ds)
It prints datasets in a given data source.
static te::dt::Date ds(2010, 01, 01)
Examples on how to access/manipulate DataSources in TerraLib.
void PrintDataSet(std::string datasetName, te::da::DataSet *dataset)
It prints the data in a given dataset.