te::gdal Namespace Reference

Namespace for the TerraLib GDAL driver implementation. More...

Classes

class  Band
 This class represents raster band description. More...
 
class  DataSet
 A GDAL data set gives access to a raster file. More...
 
class  DataSetsManager
 GDAL data set manager. More...
 
class  DataSetUseCounter
 GDAL data set use counter. More...
 
class  DataSource
 A driver to access raster data using the GDAL library. More...
 
struct  DriverMetadata
 GDAL driver metadata. More...
 
class  Globals
 An static class with global definitions for the TerraLib GDAL driver. More...
 
class  Raster
 This class represents Raster data. More...
 
class  RasterFactory
 This is the concrete factory for GDAL rasters. More...
 
class  Transactor
 

Typedefs

typedef boost::shared_ptr< DataSetDataSetPtr
 

Functions

te::da::DataSourceBuild (const te::core::URI &uri)
 
GDALDataset * CreateRaster (te::rst::Grid *g, const std::vector< te::rst::BandProperty * > &bands, const std::map< std::string, std::string > &optParams)
 Creates a raster data using GDAL. More...
 
GDALDataset * CreateRaster (const std::string &name, te::rst::Grid *g, const std::vector< te::rst::BandProperty * > &bands, const std::map< std::string, std::string > &optParams)
 Creates a raster data using GDAL. More...
 
void GDALErrorHandler (CPLErr eErrClass, int errNo, const char *msg)
 
TEGDALEXPORT void GetBandProperties (GDALDataset *gds, std::vector< te::rst::BandProperty * > &bprops)
 Gets the list of bands definition from a GDAL dataset. More...
 
te::rst::BandPropertyGetBandProperty (GDALRasterBand *gband, const unsigned int bandIndex)
 Gets the properties of a single band from a GDAL dataset. More...
 
void GetBands (te::gdal::Raster *rst, std::vector< te::gdal::Band * > &bands)
 Gets the list of bands from a GDAL dataset. More...
 
bool GetBands (te::gdal::Raster *rst, int multiResLevel, std::vector< te::gdal::Band * > &bands)
 Gets the list of bands from a GDAL dataset. More...
 
std::string GetDriverName (const std::string &dsName)
 It returns the GDAL driver name associated to a data source name. More...
 
te::gm::EnvelopeGetExtent (std::string strAccessInfo)
 Gets the extent of a raster data decoded by GDAL. More...
 
std::multimap< std::string, std::string > GetGDALAllDriversUCaseExt2DriversMap (const bool creationSupport)
 Returns a map of all GDAL supported Upper-case ( vector and raster ) extensions to their respective driver names. More...
 
GDALColorInterp GetGDALColorInterpretation (te::rst::ColorInterp ci)
 It translates a TerraLib ColorInterpretation to a GDAL ColorInterpretation. More...
 
std::string GetGDALConnectionInfo (const std::map< std::string, std::string > &connInfo)
 It returns a GDAL connection string from the given map. More...
 
GDALDataType GetGDALDataType (int tet)
 It translates a TerraLib DataType to a GDAL DataType. More...
 
std::map< std::string, DriverMetadata > & GetGDALDriversMetadata ()
 Returns metadata from all registered GDAL drivers (key: driver name). More...
 
std::multimap< std::string, std::string > GetGDALRasterDriversUCaseExt2DriversMap (const bool creationSupport)
 Returns a map of all GDAL supported Upper-case raster extensions to their respective driver names. More...
 
std::string GetGDALRessamplingMethod (te::rst::InterpolationMethod interpolationMethod)
 It translates a TerraLib interpolation method into a GDAL ressampling method name string. More...
 
std::multimap< std::string, std::string > GetGDALVectorDriversUCaseExt2DriversMap (const bool creationSupport)
 Returns a map of all GDAL supported Upper-case vector extensions to their respective driver names. More...
 
TEGDALEXPORT te::rst::GridGetGrid (GDALDataset *gds)
 Gets the grid definition from a GDAL dataset. More...
 
TEGDALEXPORT te::rst::GridGetGrid (GDALDataset *gds, const int multiResLevel)
 Gets the grid definition from a GDAL dataset. More...
 
std::string GetParentDataSetName (const std::string &subDataSetName)
 It returns the parent dataset name from a Sub DataSet name. More...
 
GDALDataset * GetRasterHandle (std::string strAccessInfo, te::common::AccessPolicy policy=te::common::RAccess)
 Get a handle to a raster file. More...
 
te::rst::RasterPropertyGetRasterProperty (std::string strAccessInfo)
 Gets the complete description from a GDAL dataset. More...
 
TEGDALEXPORT boost::mutex & getStaticMutex ()
 Returns a reference to a static mutex initialized when this module is initialized. More...
 
std::string GetSubDataSetName (const std::string &name, const std::string &driverName)
 It returns the Sub DataSet name from the given name or the same name. More...
 
te::rst::ColorInterp GetTeColorInterpretation (GDALColorInterp gci)
 It translates a GDAL ColorInterpretation to a TerraLib ColorInterpretation. More...
 
int GetTeDataType (GDALDataType gt)
 It translates a GDAL DataType to a TerraLib DataType. More...
 
te::rst::PaletteInterpretation GetTePaletteInterpretation (GDALPaletteInterp gpi)
 It translates a GDAL Pallete Interpretation to a TerraLib Pallete Interpretation. More...
 
bool IsSubDataSet (const std::string &uri)
 Returns true if the given URI is related to a sub-dataset. More...
 
std::string MakePGConnectionStr (const te::core::URI &connInfo)
 Returns a PostGIS connection string from the URI connection information. The connection string is to be used as a dataset name in GDAL data model. See also http://trac.osgeo.org/gdal/wiki/frmts_wtkraster.html. More...
 
TEGDALEXPORT void Rasterize (std::vector< te::gm::Geometry * > geometries, GDALDataset *outraster)
 Rasterizes a given vector of geometries, using GDALRasterizeGeometries function. More...
 
bool RecognizesSRID (unsigned int srid)
 It returns true if GDAL recognizes the given SRS id. More...
 
bool ReprojectRaster (te::rst::Raster const *const rin, te::rst::Raster *rout)
 Reprojects a raster to another SRS. More...
 
 TE_LOG_TRACE (TE_TR("TerraLib GDAL driver shutdown!"))
 
 TERRALIB_CPP_PLUGIN_BEGIN (Plugin) TERRALIB_CPP_PLUGIN_STARTUP
 
TEGDALEXPORT void Vectorize (GDALRasterBand *band, std::vector< te::gm::Geometry * > &geometries)
 Vectorizes a given raster band, using GDALPolygonize function. More...
 

Variables

 m_initialized = false
 
 TERRALIB_CPP_PLUGIN_SHUTDOWN
 

Detailed Description

Namespace for the TerraLib GDAL driver implementation.

Typedef Documentation

typedef boost::shared_ptr<DataSet> te::gdal::DataSetPtr

Definition at line 174 of file gdal/DataSet.h.

Function Documentation

te::da::DataSource * te::gdal::Build ( const te::core::URI uri)

Definition at line 29 of file src/terralib/gdal/DataSourceFactory.cpp.

References DataSource(), and ds.

Referenced by TERRALIB_CPP_PLUGIN_BEGIN().

GDALDataset * te::gdal::CreateRaster ( te::rst::Grid g,
const std::vector< te::rst::BandProperty * > &  bands,
const std::map< std::string, std::string > &  optParams 
)

Creates a raster data using GDAL.

Parameters
gRaster grid info.
bandsBand info.
optParamsA vector of optional parameters that are valid only for some data formats.
Returns
A pointer to a GDALDataset if it succeeds or a NULL pointer otherwise. Caller is responsible for closing it.
Exceptions
ExceptionIt throws an exception if the raster can not be created.

Definition at line 805 of file src/terralib/gdal/Utils.cpp.

References GetGDALConnectionInfo().

Referenced by te::gdal::Raster::create(), and te::gdal::Transactor::createDataSet().

GDALDataset * te::gdal::CreateRaster ( const std::string &  name,
te::rst::Grid g,
const std::vector< te::rst::BandProperty * > &  bands,
const std::map< std::string, std::string > &  optParams 
)

Creates a raster data using GDAL.

Parameters
nameThe name of the dataset to create. UTF-8 encoded.
gRaster grid info.
bandsBand info.
optParamsA vector of optional parameters that are valid only for some data formats.
Returns
A pointer to a GDALDataset if it succeeds or a NULL pointer otherwise. Caller is responsible for closing it.
Exceptions
ExceptionIt throws an exception if the raster can not be created.

Definition at line 518 of file src/terralib/gdal/Utils.cpp.

References GetDriverName(), GetGDALColorInterpretation(), GetGDALDataType(), te::rst::Grid::getGeoreference(), te::common::Singleton< SpatialReferenceSystemManager >::getInstance(), te::rst::Grid::getNumberOfColumns(), te::rst::Grid::getNumberOfRows(), te::rst::Grid::getSRID(), TL_B_PROP_CATNAME_KEY, and TL_B_PROP_DESC_KEY.

Referenced by GetGDALRessamplingMethod().

void te::gdal::GDALErrorHandler ( CPLErr  eErrClass,
int  errNo,
const char *  msg 
)

Definition at line 1267 of file src/terralib/gdal/Utils.cpp.

References TE_LOG_ERROR.

Referenced by GetGDALRessamplingMethod(), and TERRALIB_CPP_PLUGIN_BEGIN().

void te::gdal::GetBandProperties ( GDALDataset *  gds,
std::vector< te::rst::BandProperty * > &  bprops 
)

Gets the list of bands definition from a GDAL dataset.

Parameters
gdsA pointer to a GDAL dataset.
bpropsA reference to a vector to be filled with the bands description extracted from a dataset.
Note
The caller of this method must take the ownership of the returned properties.

Definition at line 200 of file src/terralib/gdal/Utils.cpp.

References GetBandProperty().

Referenced by te::wcs::Transactor::getDataSetType(), te::wms::Transactor::getDataSetType(), GetGDALRessamplingMethod(), GetRasterProperty(), and te::gdal::Transactor::getType().

te::rst::BandProperty * te::gdal::GetBandProperty ( GDALRasterBand *  gband,
const unsigned int  bandIndex 
)
void te::gdal::GetBands ( te::gdal::Raster rst,
std::vector< te::gdal::Band * > &  bands 
)

Gets the list of bands from a GDAL dataset.

Parameters
rstA pointer to the raster.
bandsA reference to a vector to be filled with the bands extracted from a dataset.
Note
The caller of this method must take the ownership of the returned properties.

Definition at line 410 of file src/terralib/gdal/Utils.cpp.

References TE_TR.

Referenced by te::gdal::Raster::create(), te::gdal::Raster::open(), and te::gdal::Raster::Raster().

bool te::gdal::GetBands ( te::gdal::Raster rst,
int  multiResLevel,
std::vector< te::gdal::Band * > &  bands 
)

Gets the list of bands from a GDAL dataset.

Parameters
rstA pointer to the raster.
multiResLevelMulti-resolution pyramid level (value -1 -> overviews disabled).
bandsA reference to a vector to be filled with the bands extracted from a dataset.
Note
The caller of this method must take the ownership of the returned properties.

Definition at line 418 of file src/terralib/gdal/Utils.cpp.

References te::gdal::Raster::getGDALDataset().

Referenced by GetGDALRessamplingMethod().

std::string te::gdal::GetDriverName ( const std::string &  dsName)

It returns the GDAL driver name associated to a data source name.

Parameters
dsNamethe name of the file that represents the data source.
Returns
the GDAL driver name, or its identifier if succeeds and a null string otherwise.

Definition at line 951 of file src/terralib/gdal/Utils.cpp.

References te::common::Convert2UCase(), and GetGDALAllDriversUCaseExt2DriversMap().

Referenced by CreateRaster(), te::gdal::Transactor::getDataSetNames(), te::gdal::Transactor::getDataSetType(), GetGDALRessamplingMethod(), and te::gdal::Raster::~Raster().

te::gm::Envelope * te::gdal::GetExtent ( std::string  strAccessInfo)

Gets the extent of a raster data decoded by GDAL.

Parameters
strAccessInfoA a string to be used by GDAL to access the raster.
Returns
A pointer to raster extent. Caller takes its ownership.

Definition at line 506 of file src/terralib/gdal/Utils.cpp.

References te::rst::Grid::getExtent(), and GetGrid().

std::multimap< std::string, std::string > te::gdal::GetGDALAllDriversUCaseExt2DriversMap ( const bool  creationSupport)

Returns a map of all GDAL supported Upper-case ( vector and raster ) extensions to their respective driver names.

Parameters
creationSupportReturn only those extensions with dataset creation support.
Returns
Returns the result map.
Note
To get only vector extensiones use GetGDALVectorDriversUCaseExt2DriversMap(().
To get only raster extensiones use GetGDALRasterDriversUCaseExt2DriversMap(().

Definition at line 1245 of file src/terralib/gdal/Utils.cpp.

References GetGDALRasterDriversUCaseExt2DriversMap(), and GetGDALVectorDriversUCaseExt2DriversMap().

Referenced by te::gdal::Transactor::getDataSetNames(), te::gdal::Transactor::getDataSetType(), GetDriverName(), and GetGDALRessamplingMethod().

GDALColorInterp te::gdal::GetGDALColorInterpretation ( te::rst::ColorInterp  ci)
inline
std::string te::gdal::GetGDALConnectionInfo ( const std::map< std::string, std::string > &  connInfo)

It returns a GDAL connection string from the given map.

Parameters
connInfoAn associative conteiner with data source connection info.
Returns
a GDAL connection string from the given map.
Exceptions
ExceptionIt throws an exception if no connection info exists in the input map.

Definition at line 975 of file src/terralib/gdal/Utils.cpp.

References TE_TR.

Referenced by CreateRaster(), and GetGDALRessamplingMethod().

std::multimap< std::string, std::string > te::gdal::GetGDALRasterDriversUCaseExt2DriversMap ( const bool  creationSupport)

Returns a map of all GDAL supported Upper-case raster extensions to their respective driver names.

Parameters
creationSupportReturn only those extensions with dataset creation support.
Returns
Returns the result map.

Definition at line 1179 of file src/terralib/gdal/Utils.cpp.

References te::common::Convert2UCase(), and GetGDALDriversMetadata().

Referenced by GetGDALAllDriversUCaseExt2DriversMap(), and GetGDALRessamplingMethod().

std::multimap< std::string, std::string > te::gdal::GetGDALVectorDriversUCaseExt2DriversMap ( const bool  creationSupport)

Returns a map of all GDAL supported Upper-case vector extensions to their respective driver names.

Parameters
creationSupportReturn only those extensions with dataset creation support.
Returns
Returns the result map.

Definition at line 1212 of file src/terralib/gdal/Utils.cpp.

References te::common::Convert2UCase(), and GetGDALDriversMetadata().

Referenced by GetGDALAllDriversUCaseExt2DriversMap(), and GetGDALRessamplingMethod().

te::rst::Grid * te::gdal::GetGrid ( GDALDataset *  gds)

Gets the grid definition from a GDAL dataset.

Parameters
gdsA pointer to a GDAL dataset.
Returns
A pointer to the grid definition from a GDAL dataset. Caller takes its ownership.

Definition at line 111 of file src/terralib/gdal/Utils.cpp.

Referenced by te::wcs::Transactor::getDataSetType(), te::wms::Transactor::getDataSetType(), GetExtent(), GetRasterProperty(), te::gdal::Transactor::getType(), te::gdal::Raster::open(), and te::gdal::Raster::Raster().

te::rst::Grid * te::gdal::GetGrid ( GDALDataset *  gds,
const int  multiResLevel 
)

Gets the grid definition from a GDAL dataset.

Parameters
gdsA pointer to a GDAL dataset.
multiResLevelMulti resolution level (use -1 to use the original resolution).
Returns
A pointer to the grid definition from a GDAL dataset. Caller takes its ownership.

Definition at line 116 of file src/terralib/gdal/Utils.cpp.

References te::ogr::Convert2TerraLibProjection(), getStaticMutex(), te::sa::Grid, nCols, and TE_UNKNOWN_SRS.

Referenced by GetGDALRessamplingMethod().

std::string te::gdal::GetParentDataSetName ( const std::string &  subDataSetName)

It returns the parent dataset name from a Sub DataSet name.

Parameters
subDataSetNameThe Full SubDataSet string name.
Returns
the parent dataset name from a Sub DataSet name.
Note
If the given name does not refers to a sub-dataset it will be returned.

Definition at line 1063 of file src/terralib/gdal/Utils.cpp.

References IsSubDataSet().

Referenced by te::gdal::DataSource::exists(), te::gdal::Transactor::getDataSetType(), GetGDALRessamplingMethod(), te::gdal::Transactor::getType(), te::gdal::DataSource::isValid(), te::gdal::Raster::open(), and te::gdal::Raster::Raster().

GDALDataset * te::gdal::GetRasterHandle ( std::string  strAccessInfo,
te::common::AccessPolicy  policy = te::common::RAccess 
)

Get a handle to a raster file.

Parameters
filenameFile name (path included).
policyThe access permission requested.
Returns
A pointer to GDAL dataset if it succeeds or a NULL pointer otherwise.

Definition at line 816 of file src/terralib/gdal/Utils.cpp.

References te::common::RWAccess, and te::common::WAccess.

Referenced by te::gdal::Raster::create(), GetGDALRessamplingMethod(), te::gdal::Raster::open(), and te::gdal::Raster::Raster().

te::rst::RasterProperty * te::gdal::GetRasterProperty ( std::string  strAccessInfo)

Gets the complete description from a GDAL dataset.

Parameters
strAccessInfoA a string to be used by GDAL to access the raster.
Returns
A pointer to the raster description from a GDAL dataset. Caller takes its ownership.

Definition at line 485 of file src/terralib/gdal/Utils.cpp.

References GetBandProperties(), and GetGrid().

Referenced by GetGDALRessamplingMethod().

boost::mutex & te::gdal::getStaticMutex ( )

Returns a reference to a static mutex initialized when this module is initialized.

Returns
Returns a reference to a static mutex initialized when this module is initialized.

Definition at line 1093 of file src/terralib/gdal/Utils.cpp.

Referenced by GetGDALRessamplingMethod(), GetGrid(), and TERRALIB_CPP_PLUGIN_BEGIN().

std::string te::gdal::GetSubDataSetName ( const std::string &  name,
const std::string &  driverName 
)

It returns the Sub DataSet name from the given name or the same name.

Parameters
nameThe Full SubDataSet string name.
driverNameThe driver name.
Returns
The Sub DataSet name from the given name.

Definition at line 70 of file src/terralib/gdal/Utils.cpp.

Referenced by te::gdal::Transactor::getDataSetNames(), te::gdal::Transactor::getDataSetType(), and GetGDALRessamplingMethod().

te::rst::PaletteInterpretation te::gdal::GetTePaletteInterpretation ( GDALPaletteInterp  gpi)
inline

It translates a GDAL Pallete Interpretation to a TerraLib Pallete Interpretation.

Definition at line 180 of file src/terralib/gdal/Utils.h.

References te::rst::CMYKPalInt, te::rst::GrayPalInt, te::rst::HSLPalInt, te::rst::RGBPalInt, and te::rst::UndefPalInt.

bool te::gdal::IsSubDataSet ( const std::string &  uri)

Returns true if the given URI is related to a sub-dataset.

Parameters
uriThe given URI.
Returns
true if the given URI is related to a sub-dataset.

Definition at line 1040 of file src/terralib/gdal/Utils.cpp.

Referenced by GetGDALRessamplingMethod(), GetParentDataSetName(), te::gdal::Raster::open(), and te::gdal::Raster::Raster().

std::string te::gdal::MakePGConnectionStr ( const te::core::URI connInfo)

Returns a PostGIS connection string from the URI connection information. The connection string is to be used as a dataset name in GDAL data model. See also http://trac.osgeo.org/gdal/wiki/frmts_wtkraster.html.

Parameters
connInfoThe URI parameters.
Returns
Returns a PostGIS connection string from the set connection information.

Definition at line 828 of file src/terralib/gdal/Utils.cpp.

References te::core::Expand(), te::core::URI::host(), te::core::URI::password(), te::core::URI::path(), te::core::URI::port(), te::core::URI::query(), te::core::URIDecode(), and te::core::URI::user().

Referenced by te::gdal::DataSource::exists(), GetGDALRessamplingMethod(), te::gdal::DataSource::isValid(), and te::gdal::DataSource::open().

void te::gdal::Rasterize ( std::vector< te::gm::Geometry * >  geometries,
GDALDataset *  outraster 
)

Rasterizes a given vector of geometries, using GDALRasterizeGeometries function.

Parameters
geometriesA vector of geometries to be rasterized.
outrasterA reference to the GDAL dataset where the rasterized geometries will be drawn.

Definition at line 1015 of file src/terralib/gdal/Utils.cpp.

References te::ogr::Convert2OGR().

Referenced by GetGDALRessamplingMethod().

bool te::gdal::RecognizesSRID ( unsigned int  srid)

It returns true if GDAL recognizes the given SRS id.

Parameters
sridThe SRS identifier.
Returns
true if GDAL recognizes the given SRS id or false otherwise.

Definition at line 891 of file src/terralib/gdal/Utils.cpp.

Referenced by GetGDALRessamplingMethod(), and te::gdal::Raster::transform().

bool te::gdal::ReprojectRaster ( te::rst::Raster const *const  rin,
te::rst::Raster rout 
)

Reprojects a raster to another SRS.

Parameters
rinThe input raster file. Do not pass a null pointer.
routThe new output raster. Do not pass a null pointer.
Returns
true If the reprojection was done or false otherwise.

Definition at line 902 of file src/terralib/gdal/Utils.cpp.

References b, and te::gdal::Raster::getGDALDataset().

Referenced by te::gdal::Raster::transform().

te::gdal::TE_LOG_TRACE ( TE_TR("TerraLib GDAL driver shutdown!")  )
void te::gdal::Vectorize ( GDALRasterBand *  band,
std::vector< te::gm::Geometry * > &  geometries 
)

Vectorizes a given raster band, using GDALPolygonize function.

Parameters
bandThe band to vectorize.
geometriesA reference to a vector of geometries. Will be filled with geometries found in band.

Definition at line 990 of file src/terralib/gdal/Utils.cpp.

References te::ogr::Convert2TerraLib(), and ds.

Referenced by ClassifierDialogExample(), and GetGDALRessamplingMethod().

Variable Documentation

te::gdal::m_initialized = false

Definition at line 254 of file src/terralib/gdal/Plugin.cpp.

Referenced by TERRALIB_CPP_PLUGIN_BEGIN().

te::gdal::TERRALIB_CPP_PLUGIN_SHUTDOWN
Initial value:

Definition at line 239 of file src/terralib/gdal/Plugin.cpp.

Referenced by TERRALIB_CPP_PLUGIN_BEGIN().