54 std::cout <<
"This example shows how to use the GDAL PostGIS Raster support using Raster API." << std::endl << std::endl;
57 std::map<std::string, std::string> rinfo;
58 rinfo[
"URI"] =
"PG:host=localhost port=5432 dbname='raster_db' user='postgres' password='****' schema='public' table=cbers mode=2";
63 std::string uriOut = TERRALIB_DATA_DIR
"/geotiff/raster_pgis_rasterAPI.tif";
69 std::cout <<
"End. Check the PostGIS Raster copy to file: raster_pgis_rasterAPI.tif." << std::endl << std::endl;
73 std::cout <<
"PostGIS Raster copy failed!" << std::endl << std::endl;
76 std::cout <<
"Done!" << std::endl << std::endl;
78 catch (
const std::exception& e)
80 std::cout << std::endl <<
"An exception has occurred in PostGISRaster(): " << e.what() << std::endl;
84 std::cout << std::endl <<
"An unexpected exception has occurred in PostGISRaster()!" << std::endl;
92 std::cout <<
"This example shows how to use the GDAL PostGIS Raster support using DataSource API." << std::endl << std::endl;
95 std::map<std::string, std::string> rinfo;
97 std::string uri =
"PG://postgres:*****@localhost:5432/raster_db?schema=public&table=cbers&mode=2";
105 std::vector<std::string> dsNames = ds->getDataSetNames();
107 std::unique_ptr<te::da::DataSet> dataSet = ds->getDataSet(dsNames[0]);
111 std::unique_ptr<te::rst::Raster> inraster = dataSet->getRaster(rpos);
115 std::string uriOut = TERRALIB_DATA_DIR
"/geotiff/raster_pgis_dataSourceAPI.tif";
121 std::cout <<
"End. Check the PostGIS Raster copy to file: raster_pgis_dataSourceAPI.tif." << std::endl << std::endl;
125 std::cout <<
"PostGIS Raster copy failed!" << std::endl << std::endl;
128 std::cout <<
"Done!" << std::endl << std::endl;
130 catch (
const std::exception& e)
132 std::cout << std::endl <<
"An exception has occurred in PostGISRaster(): " << e.what() << std::endl;
136 std::cout << std::endl <<
"An unexpected exception has occurred in PostGISRaster()!" << std::endl;
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
void PostGISRaster_RasterAPI()
TERASTEREXPORT te::rst::RasterPtr CreateCopy(const te::rst::Raster &rin, const std::string &uri, const std::string &rType=std::string("GDAL"))
Create a new raster from existing one.
static te::dt::Date ds(2010, 01, 01)
boost::shared_ptr< Raster > RasterPtr
void PostGISRaster()
This example shows how to use the GDAL PostGIS Raster support.
These routines show how to use the raster module and the GDAL data source module. ...
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
This file contains include headers for the Vector Geometry model of TerraLib.
A dataset is the unit of information manipulated by the data access module of TerraLib.
This file contains include headers for the Data Access module of TerraLib.
static Raster * open(const std::map< std::string, std::string > &rinfo, te::common::AccessPolicy p=te::common::RAccess)
It opens a raster with the given parameters and default raster driver.
void PostGISRaster_DataSourceAPI()