27 #include "../../../geometry/Envelope.h"
28 #include "../../../geometry/serialization/xml/Serializer.h"
29 #include "../../../xml/AbstractWriter.h"
30 #include "../../../xml/AbstractWriterFactory.h"
31 #include "../../../xml/Reader.h"
32 #include "../../Band.h"
33 #include "../../BandProperty.h"
34 #include "../../Grid.h"
35 #include "../../Raster.h"
44 #include <boost/lexical_cast.hpp>
56 std::string k = reader.
getAttr(
"k");
57 std::string v = reader.
getAttr(
"v");
75 std::map<std::string, std::string>::const_iterator it = rinfo.begin();
76 std::map<std::string, std::string>::const_iterator itend = rinfo.end();
93 std::fstream ostr(fileName.c_str(), std::ios_base::out);
104 Save(raster, *w.get());
113 writer.
writeAttribute(
"xmlns:xlink",
"http://www.w3.org/1999/xlink");
114 writer.
writeAttribute(
"xmlns:xsd",
"http://www.w3.org/2001/XMLSchema-instance");
115 writer.
writeAttribute(
"xmlns",
"http://www.terralib.org/schemas/raster");
116 writer.
writeAttribute(
"xsd:schemaLocation",
"http://www.terralib.org/schemas/raster C:/Users/gribeiro/Documents/terralib5/trunk/myschemas/terralib/raster/raster.xsd");
131 std::map<std::string, std::string> rinfo = raster->
getInfo();
143 double* geo =
new double[6];
170 std::auto_ptr<te::gm::Envelope> e(
ReadExtent(reader));
246 std::vector<te::rst::BandProperty*> bands;
unsigned int getNumberOfRows() const
Returns the grid number of rows.
virtual std::map< std::string, std::string > getInfo() const =0
It returns additional information about the raster.
std::size_t m_idx
The band index.
virtual boost::int32_t getElementValueAsInt32() const
It returns the element data value in the case of VALUE node.
This class models a XML reader object.
TERASTEREXPORT te::rst::Grid * ReadGrid(te::xml::Reader &reader)
A raster band description.
virtual void writeStartElement(const std::string &qName)=0
int getSRID() const
Returns the grid spatial reference system identifier.
int m_nblocksx
The number of blocks in x.
virtual const Band * getBand(std::size_t i) const =0
Returns the raster i-th band.
int m_nblocksy
The number of blocks in y.
static te::xml::AbstractWriter * make()
It creates a new XML writer using the dafault implementation.
void setGeoreference(const te::gm::Coord2D &ulLocation, int srid, double resX, double resY)
Sets the information needed to georeference the grid.
int m_type
The data type of the elements in the band.
TERASTEREXPORT void ReadRasterInfo(std::map< std::string, std::string > &rinfo, te::xml::Reader &reader)
double m_noDataValue
Value to indicate elements where there is no data, default is std::numeric_limits::max().
This class models a XML writer object.
TERASTEREXPORT double * ReadGeoTransform(te::xml::Reader &reader)
virtual std::string getElementLocalName() const =0
It returns the local part of the element name in the case of an element node.
virtual boost::int32_t getAttrAsInt32(const std::string &name) const
It returns the attribute value in the case of an element node with valid attributes.
TERASTEREXPORT te::rst::BandProperty * ReadBandProperty(te::xml::Reader &reader)
virtual void writeElement(const std::string &qName, const std::string &value)=0
An Envelope defines a 2D rectangular region.
An abstract class for raster data strucutures.
Auxiliary classes and functions to read geometry information from a XML document. ...
const double * getGeoreference() const
Returns a list of 6 coefficients describing an affine transformation to georeference a grid...
BandProperty * getProperty()
Returns the band property.
int m_blkw
Block width (pixels).
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster.
TEGEOMEXPORT std::auto_ptr< te::gm::Envelope > ReadExtent(te::xml::Reader &reader)
TEDATAACCESSEXPORT void Save(const std::string &fileName)
unsigned int getNumberOfColumns() const
Returns the grid number of columns.
TEGEOMEXPORT void SaveExtent(const te::gm::Envelope &e, te::xml::AbstractWriter &writer)
Grid * getGrid()
It returns the raster grid.
virtual std::string getAttr(const std::string &name) const =0
It returns the attribute value in the case of an element node with valid attributes.
const std::string & getName() const
Returns the raster name.
virtual void writeAttribute(const std::string &attName, const std::string &value)=0
virtual NodeType getNodeType() const =0
It return the type of node read.
te::gm::Envelope * getExtent()
Returns the geographic extension of the grid.
TERASTEREXPORT std::vector< te::rst::BandProperty * > ReadBandPropertyVector(te::xml::Reader &reader)
virtual double getAttrAsDouble(const std::string &name) const
It returns the attribute value in the case of an element node with valid attributes.
virtual void writeEndElement(const std::string &qName)=0
virtual void writeStartDocument(const std::string &encoding, const std::string &standalone)=0
int m_blkh
Block height (pixels).
TERASTEREXPORT void SaveRasterInfo(std::map< std::string, std::string > &rinfo, te::xml::AbstractWriter &writer)
A rectified grid is the spatial support for raster data.
virtual bool next()=0
It gets the next event to be read.