29 #include "../../dataaccess/datasource/DataSource.h"
30 #include "../../dataaccess/datasource/DataSourceManager.h"
31 #include "../../dataaccess/utils/Utils.h"
32 #include "../../datatype/SimpleProperty.h"
33 #include "../../geometry/Geometry.h"
34 #include "../../geometry/GeometryProperty.h"
35 #include "../../memory/DataSet.h"
36 #include "../../memory/DataSetItem.h"
37 #include "../../raster/BandProperty.h"
38 #include "../../raster/Grid.h"
39 #include "../../raster/Raster.h"
40 #include "../../raster/RasterFactory.h"
48 #include <boost/uuid/random_generator.hpp>
49 #include <boost/uuid/uuid_io.hpp>
61 m_outputParams.reset(outParams);
89 std::auto_ptr<te::mem::DataSet> dataSet = createDataSet(inputParams->
m_ds.get(), dsType);
129 double res = val / m_outputParams->m_nCols;
138 std::vector<te::rst::BandProperty*> vecBandProp;
139 vecBandProp.push_back(bProp);
142 std::string fileName = m_outputParams->m_outputPath +
"/" + m_outputParams->m_outputDataSetName +
".tif";
144 std::map<std::string, std::string> rInfo;
145 rInfo[
"URI"] = fileName;
156 std::string fileName = m_outputParams->m_outputPath +
"/" + m_outputParams->m_outputDataSetName +
".shp";
159 std::map<std::string, std::string> info;
160 info[
"URI"] = fileName;
163 boost::uuids::basic_random_generator<boost::mt19937> gen;
164 boost::uuids::uuid u = gen();
165 std::string id_ds = boost::uuids::to_string(u);
173 std::map<std::string, std::string> options;
175 ds->createDataSet(dsType, options);
177 ds->add(m_outputParams->m_outputDataSetName, dataSet, options);
182 std::auto_ptr<te::da::DataSetType> dataSetType(
new te::da::DataSetType(m_outputParams->m_outputDataSetName));
185 std::vector<te::dt::Property*> propertyVec = dsType->
getProperties();
187 for(std::size_t t = 0; t < propertyVec.size(); ++t)
195 dataSetType->add(newProp);
200 dataSetType->add(kernelProperty);
218 for(std::size_t t = 0; t < nProp; ++t)
226 outDSetItem->
setDouble(m_outputParams->m_outputAttrName, 0.);
229 outDataset->add(outDSetItem);
KernelOperation()
Default constructor.
std::auto_ptr< te::mem::DataSet > runDataSetKernel(te::sa::KernelInputParams *inputParams, te::sa::KernelTree &kTree, te::sa::KernelMap &kMap, te::da::DataSetType *dsType)
std::auto_ptr< te::da::DataSetType > createDataSetType(te::da::DataSetType *dsType)
TESAEXPORT void GridAdaptRadiusKernel(te::sa::KernelInputParams *params, te::sa::KernelTree &kTree, te::sa::KernelMap &kMap, te::rst::Raster *raster)
Evaluates kernel value using a raster as output data and a adaptative value for radius.
Utility functions for the data access module.
void setDouble(std::size_t i, double value)
It sets the value of the i-th property.
An atomic property like an integer or double.
TESAEXPORT void GridStatRadiusKernel(te::sa::KernelInputParams *params, te::sa::KernelTree &kTree, te::sa::KernelMap &kMap, te::rst::Raster *raster, double radius)
Evaluates kernel value using a raster as output data and a fixed value for radius.
boost::shared_ptr< DataSource > DataSourcePtr
A raster band description.
A class that models the description of a dataset.
void saveDataSet(te::da::DataSet *dataSet, te::da::DataSetType *dsType)
virtual Property * clone() const =0
It returns a clone of the object.
std::map< int, std::pair< te::gm::Geometry *, double > > KernelMap
void setValue(std::size_t i, te::dt::AbstractData *value)
It sets the value of the i-th property.
double getWidth() const
It returns the envelope width.
double m_noDataValue
Value to indicate elements where there is no data, default is std::numeric_limits::max().
std::auto_ptr< te::mem::DataSet > createDataSet(te::da::DataSet *inputDataSet, te::da::DataSetType *dsType)
Class that represents the kernel output parameters.
It models a property definition.
void setOutputParameters(te::sa::KernelOutputParams *outParams)
TESAEXPORT void DataSetAdaptRadiusKernel(te::sa::KernelInputParams *params, te::sa::KernelTree &kTree, te::sa::KernelMap &kMap, te::mem::DataSet *ds, int kernelIdx, int geomIdx)
Evaluates kernel value using a dataset as output data and a adaptative value for radius.
void runRasterKernel(te::sa::KernelInputParams *inputParams, te::sa::KernelTree &kTree, te::sa::KernelMap &kMap, te::rst::Raster *raster)
void setId(unsigned int id)
It sets the property identifier.
virtual bool moveNext()=0
It moves the internal pointer to the next item of the collection.
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
const std::vector< Property * > & getProperties() const
It returns the list of properties describing the CompositeProperty.
int getSRID() const
It returns the spatial reference system identifier associated to this property.
static DataSourceManager & getInstance()
It returns a reference to the singleton instance.
An Envelope defines a 2D rectangular region.
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
An abstract class for raster data strucutures.
virtual ~KernelOperation()
Virtual destructor.
A base class for values that can be retrieved from the data access module.
Grid * getGrid()
It returns the raster grid.
virtual std::size_t getNumProperties() const =0
It returns the number of properties that composes an item of the dataset.
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver...
A dataset is the unit of information manipulated by the data access module of TerraLib.
const te::gm::Envelope & getMBR(void) const
It returns the bounding box of all elements in the tree.
virtual bool moveBeforeFirst()=0
It moves the internal pointer to a position before the first item in the collection.
static Raster * make()
It creates and returns an empty raster with default raster driver.
te::gm::Envelope * getExtent()
Returns the geographic extension of the grid.
This file contains a class that represents the kernel operation.
std::size_t getPropertyPosition(const std::string &name) const
It returns the property position based on its name.
std::auto_ptr< te::rst::Raster > buildRaster(te::sa::KernelInputParams *inputParams, te::sa::KernelTree &kTree, std::string driver)
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
TESAEXPORT void DataSetStatRadiusKernel(te::sa::KernelInputParams *params, te::sa::KernelTree &kTree, te::sa::KernelMap &kMap, te::mem::DataSet *ds, int kernelIdx, int geomIdx, double radius)
Evaluates kernel value using a dataset as output data and a fixed value for radius.
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
A rectified grid is the spatial support for raster data.
double getHeight() const
It returns the envelope height.
virtual std::auto_ptr< te::dt::AbstractData > getValue(std::size_t i) const
Method for retrieving any other type of data value stored in the data source.
void setParent(Property *p)
It associate this property to the informed parent.