37 #include <boost/filesystem.hpp> 
   40 #include <gdal_priv.h> 
   42 namespace fs = boost::filesystem;
 
   80     errorMessage = 
"Error in the number of bands!";
 
   84   std::vector<te::rst::BandProperty*> bandProps;
 
   97     for(
int unsigned i = 0; i < bandVec.size(); i++)
 
  108   std::map<std::string, std::string> newRasterInfo;
 
  109   newRasterInfo[
"URI"] = output;
 
  119         std::vector<std::complex<double>> values;
 
  133         for(
int unsigned b = 0; b < bandVec.size(); b++)
 
  135           std::complex<double> value;
 
  136           raster->
getValue(c, r, value, bandVec[b]);
 
  138           newRaster->
setValue(c, r, value, bandVec[b]);
 
  165   std::map<std::string, std::string> outInfo;
 
  167   outInfo[
"URI"] = output;
 
  183   output << raster->
toString() << std::endl << std::endl;
 
  185   output << 
"Bands Type Informations:" << std::endl << std::endl;
 
  197   output << 
"Block Informations:" << std::endl << std::endl;
 
  212   std::string finalOutput = 
"";
 
  217     if(output == m_input)
 
  219       errorMessage = 
"Con not convert the raster for the same path and same extension!";
 
  224       finalOutput = output;
 
  227   else if(!extension.empty())
 
  229     if(extension[0] != 
'.')
 
  230       extension = 
"." + extension;
 
  232     fs::path temp(m_input);
 
  233     temp.replace_extension(extension);
 
  235     finalOutput = temp.string();
 
  237     if(finalOutput == m_input)
 
  239       errorMessage = 
"Con not convert the raster for the same path and same extension!";
 
  245     errorMessage = 
"For this operations you must enter with the output path (\"--output\") or the output extension (\"--extension\")!";
 
  253   if(!copyRaster(finalOutput, bandVec, 
int(),errorMessage))
 
  270   if(method < 1 || method > 3)
 
  272     errorMessage = 
"Method invalid!";
 
  280   std::map<std::string, std::string> newRasterInfo;
 
  281   newRasterInfo[
"URI"] = output;
 
  283   raster->
resample(method, scale, newRasterInfo);
 
  307   std::map<std::string, std::string> outInfo;
 
  308   outInfo[
"URI"] = output;
 
  309   raster->
trim(newRasterEnv, outInfo);
 
  328   std::cout << 
"Supported Extensions" << std::endl;
 
  329   std::cout << 
"--------------------" << std::endl << std::endl;
 
  333     std::cout << it->first << std::endl;
 
  335     std::map<std::string, std::string> map = 
static_cast<te::rst::RasterFactory*
>(it->second)->getCapabilities();
 
  337     std::cout << 
"  " << map[
"supported_formats"] << std::endl << std::endl;
 
  355   std::map<std::string, std::string> map;
 
static bool checkOutputPath(std::string outputPath, std::string &errorMessage)
Check output raster path. 
 
int m_blkh
Block height (pixels). 
 
int getType() const 
It returns the data type of the elements in the band. 
 
virtual void setValue(unsigned int c, unsigned int r, const double value, std::size_t b=0)
Sets the attribute value in a band of a cell. 
 
std::string toString(void) const 
It returns the data value in a string notation. 
 
unsigned int getNumberOfRows() const 
Returns the raster number of rows. 
 
Grid * getGrid()
It returns the raster grid. 
 
bool copyRaster(std::string output, std::vector< int > bandVec, int bandType, std::string &errorMessage)
Copy a raster. 
 
Terralib Raster Manager Tool Utils. 
 
static Raster * make()
It creates and returns an empty raster with default raster driver. 
 
int m_nblocksy
The number of blocks in y. 
 
This class represents a dictionary of factories. 
 
static bool getRaster(std::string path, te::rst::Raster *&raster, std::string &errorMessage)
Get a raster based in the path. 
 
static bool loadModules(std::string &errorMessage)
Load Terralib modules. 
 
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster. 
 
virtual void getValue(unsigned int c, unsigned int r, double &value, std::size_t b=0) const 
Returns the attribute value of a band of a cell. 
 
Terralib Raster Manager Tool. 
 
te::gm::Envelope * getExtent()
Returns the geographic extension of the raster data. 
 
A rectified grid is the spatial support for raster data. 
 
int m_blkw
Block width (pixels). 
 
static bool checkInputPath(std::string inputPath, std::string &errorMessage)
Check input raster path. 
 
It contains the algorithm to reproject raster data. 
 
bool getSupportedExtensions(std::vector< std::string > &extents, std::string &errorMessage)
Get Supported Extensions. 
 
bool changeResolution(std::string output, int method, int scale, std::string &errorMessage)
Change Raster resolution. 
 
static dictionary_type & getDictionary()
It returns a reference to the internal dictionary of concrete factories. 
 
void Tokenize(const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters=" ")
It tokenizes a given string with a delimiter of your own choice. 
 
TERASTEREXPORT te::rst::Raster * Reproject(te::rst::Raster const *const rin, int srid, const std::map< std::string, std::string > &routinfo, int m=te::rst::Interpolator::NearestNeighbor)
Reprojects a raster to another SRS. 
 
std::string Convert2String(boost::int16_t value)
It converts a short integer value to a string. 
 
unsigned int getNumberOfColumns() const 
Returns the raster number of columns. 
 
A raster band description. 
 
virtual Raster * trim(const te::gm::Envelope *env, const std::map< std::string, std::string > &rinfo)
Subsetting operation for trimming (cropping) the raster. 
 
This file contains include headers for the TerraLib Common Runtime module. 
 
virtual void setValues(unsigned int c, unsigned int r, const std::vector< double > &values)
Sets the imaginary attribute values in all complex bands of a cell. 
 
bool getRasterInfo(std::ostringstream &output, std::string &errorMessage)
Show raster informations. 
 
int m_nblocksx
The number of blocks in x. 
 
An abstract class for raster data strucutures. 
 
virtual Raster * resample(int method, unsigned int drow, unsigned int dcolumn, unsigned int height, unsigned int width, unsigned int newheight, unsigned int newwidth, const std::map< std::string, std::string > &rinfo)
Resample a subset of the raster, given a box. 
 
BandProperty * getProperty()
Returns the band property. 
 
virtual const Band * getBand(std::size_t i) const =0
Returns the raster i-th band. 
 
An Envelope defines a 2D rectangular region. 
 
std::map< TFACTORYKEY, TFACTORY *, TKEYCOMPARE >::const_iterator const_iterator
 
bool showSupportedExtensions(std::string &errorMessage)
Show Supported Extensions. 
 
bool reproject(std::string output, int srid, std::string &errorMessage)
Reproject a raster. 
 
An Envelope defines a 2D rectangular region. 
 
virtual void getValues(unsigned int c, unsigned int r, std::vector< double > &values) const 
Returns the imaginary attribute values in all complex bands of a cell. 
 
std::map< TFACTORYKEY, TFACTORY *, TKEYCOMPARE >::const_iterator end() const 
It returns an iterator to the end of the container. 
 
This is the abstract factory for Rasters. 
 
bool trim(std::string output, std::vector< double > env, std::string &errorMessage)
Trim a raster. 
 
te::da::DataSourceCapabilities capabilities
 
bool convert(std::string output, std::string extension, std::vector< int > bandVec, std::string &errorMessage)
Convert a raster. 
 
bool init(std::string input, std::string &errorMessage)
Init the application. 
 
std::map< TFACTORYKEY, TFACTORY *, TKEYCOMPARE >::const_iterator begin() const 
It returns an iterator to the first stored factory.