27 #include "../common/StringUtils.h" 
   28 #include "../common/Translator.h" 
   29 #include "../geometry/Envelope.h" 
   30 #include "../dataaccess/dataset/DataSetType.h" 
   31 #include "../raster/Grid.h" 
   32 #include "../raster/Raster.h" 
   33 #include "../raster/RasterProperty.h" 
   42 #include <gdal_priv.h> 
   45 #include <boost/filesystem.hpp> 
   46 #include <boost/format.hpp> 
   66   return m_connectionInfo;
 
   71   m_connectionInfo = connInfo;
 
   80   if (m_connectionInfo.empty())
 
   81       throw Exception((boost::format(
TR_GDAL(
"Empty data source connection information"))).str());
 
   83   std::map<std::string, std::string>::const_iterator it = m_connectionInfo.find(
"SOURCE");
 
   84   if (it != m_connectionInfo.end())
 
   85     m_straccess = it->second;
 
   88     it = m_connectionInfo.find(
"URI");
 
   89     if (it != m_connectionInfo.end())
 
   90       m_straccess = it->second;
 
   92       throw Exception((boost::format(
TR_GDAL(
"Invalid data source connection information"))).str());
 
  108   if(m_connectionInfo.empty())
 
  111   std::map<std::string, std::string>::const_iterator it = m_connectionInfo.find(
"SOURCE");
 
  114   if(it != m_connectionInfo.end())
 
  116     if(boost::filesystem::is_directory(it->second))
 
  121     it = m_connectionInfo.find(
"URI");
 
  123     if(it == m_connectionInfo.end())
 
  129     GDALDataset* gds = 
static_cast<GDALDataset*
>(GDALOpen(it->second.c_str(), GA_ReadOnly));
 
  143   return sm_capabilities;
 
  150     throw Exception((boost::format(
TR_GDAL(
"Data source is not open."))).str());    
 
  162   m_connectionInfo = dsInfo;
 
  165   std::map<std::string, std::string>::const_iterator it = m_connectionInfo.find(
"SOURCE");
 
  166   if(it != m_connectionInfo.end())
 
  170       if(!boost::filesystem::is_directory(it->second))
 
  171         boost::filesystem::create_directory(it->second);
 
  173     catch(
const boost::filesystem::filesystem_error& e) 
 
  175       throw Exception((boost::format(
TR_GDAL(
"Could not create the data source due to the following error: %1%.")) % e.what()).str());
 
  180     throw Exception((boost::format(
TR_GDAL(
"Data source creation is supported only for directory data sources"))).str());
 
  186   std::map<std::string, std::string>::const_iterator it = dsInfo.find(
"SOURCE"); 
 
  187   if(it != dsInfo.end())   
 
  189     if (boost::filesystem::exists(it->second) && boost::filesystem::is_directory(it->second)) 
 
  195   it = dsInfo.find(
"URI"); 
 
  196   if(it != dsInfo.end())   
 
  200     GDALDataset* gds = 
static_cast<GDALDataset*
>(GDALOpen(it->second.c_str(), GA_ReadOnly));
 
  215   std::map<std::string, std::string>::const_iterator it = dsInfo.find(
"URI");
 
  216   if (it == dsInfo.end())
 
  217     it = dsInfo.find(
"SOURCE");
 
  219   if (it == dsInfo.end())
 
  224     boost::filesystem::remove(it->second);
 
  226   catch(
const boost::filesystem::filesystem_error& ) 
 
  232   std::vector<std::string> dsnames;
 
  234   std::map<std::string, std::string>::const_iterator it = dsInfo.find(
"URI");
 
  235   if (it != dsInfo.end())
 
  236     dsnames.push_back(it->second);
 
  239     it = dsInfo.find(
"SOURCE");
 
  240     if (it != dsInfo.end())
 
  241       dsnames.push_back(it->second);
 
  243       throw Exception((boost::format(
TR_GDAL(
"Empty ou invalid data source connection information"))).str());
 
  250   return std::vector<std::string>();
 
static void setCapabilities(const te::da::DataSourceCapabilities &capabilities)
 
std::string getType() const 
It returns the data source type name (in UPPER CASE). Ex: POSTGIS, SQLITE, WFS, WMS, or MYSQL. 
 
std::string GetParentDataSetName(const std::string &subDataSetName)
It returns the parent dataset name from a Sub DataSet name. 
 
A class that represents the known capabilities of a specific data source, i.e. this class informs all...
 
~DataSource()
Virtual destructor. 
 
GDAL data set use counter. 
 
std::vector< std::string > getEncodings(const std::map< std::string, std::string > &dsInfo)
It gets the encodings for the data source. 
 
const te::da::DataSourceCapabilities & getCapabilities() const 
It returns the known capabilities of the data source. 
 
void setConnectionInfo(const std::map< std::string, std::string > &connInfo)
It sets the connection information to be used when connecting to the data source. ...
 
bool exists(const std::map< std::string, std::string > &dsInfo)
Check the existence of a data source in a driver. 
 
void close()
It closes the data source and clears all the resources used by its internal communication channel...
 
void create(const std::map< std::string, std::string > &dsInfo)
It creates a new data source. 
 
std::auto_ptr< te::da::DataSourceTransactor > getTransactor()
It returns an object that can execute transactions in the context of a data source. 
 
An exception class for the GDAL module. 
 
std::vector< std::string > getDataSourceNames(const std::map< std::string, std::string > &dsInfo)
It gets the data source names available in a driver. 
 
Utilitary functions to access GDAL and match some of its concepts to TerraLib concepts. 
 
#define TE_GDAL_DRIVER_IDENTIFIER
 
void open()
It opens the data source and makes it ready for using. 
 
bool isOpened() const 
It returns true if the data source is opened, otherwise it returns false. 
 
void drop(const std::map< std::string, std::string > &dsInfo)
It removes the data source with the connection information from a driver. 
 
static te::da::DataSourceCapabilities sm_capabilities
 
bool isValid() const 
It checks if the data source is valid (available for using). 
 
The implementation of a DataSource that consists of datasets that can be decoded by the GDAL Library...
 
te::da::DataSourceCapabilities capabilities
 
#define TR_GDAL(message)
It marks a string in order to get translated. This is a special mark used in the Vector Geometry modu...
 
const std::map< std::string, std::string > & getConnectionInfo() const 
It returns the set of parameters used to set up the access channel to the underlying repository...