RasterToVector.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file RasterToVector.cpp
22  */
23 
24 #include "../common/progress/TaskProgress.h"
25 #include "../common/Translator.h"
26 
27 #include "../dataaccess/dataset/DataSet.h"
28 #include "../dataaccess/dataset/DataSetAdapter.h"
29 
30 #include "../dataaccess/dataset/DataSetType.h"
31 #include "../dataaccess/dataset/DataSetTypeConverter.h"
32 #include "../dataaccess/dataset/ObjectIdSet.h"
33 #include "../dataaccess/datasource/DataSource.h"
34 #include "../dataaccess/datasource/DataSourceCapabilities.h"
35 #include "../dataaccess/utils/Utils.h"
36 
37 #include "../datatype/Property.h"
38 #include "../datatype/StringProperty.h"
39 
40 #include "../geometry.h"
41 
42 #include "../memory/DataSetItem.h"
43 
44 #include "../raster/RasterProperty.h"
45 #include "../raster/Utils.h"
46 
47 #include "../rp/RasterAttributes.h"
48 #include "../rp/Texture.h"
49 
50 #include "../statistics.h"
51 
52 #include "Exception.h"
53 #include "RasterToVector.h"
54 
55 // Boost
56 #include <boost/algorithm/string.hpp>
57 #include <boost/lexical_cast.hpp>
58 
59 
61  : m_texture(false)
62 {
63 }
64 
66  std::string inRasterName,
67  std::auto_ptr<te::da::DataSetType> inRasterDsType,
68  te::da::DataSourcePtr inVectorDsrc,
69  std::string inVectorName,
70  std::auto_ptr<te::da::DataSetType> inVectorDsType)
71 {
72  m_inRasterDsrc = inRasterDsrc;
73  m_inRasterName = inRasterName;
74  m_inRasterDsType = inRasterDsType;
75  m_inVectorDsrc = inVectorDsrc;
76  m_inVectorName = inVectorName;
77  m_inVectorDsType = inVectorDsType;
78 }
79 
80 void te::attributefill::RasterToVector::setParams(std::vector<unsigned int> bands,
81  std::vector<te::stat::StatisticalSummary> statSum,
82  bool texture)
83 {
84  m_bands = bands;
85  m_statSum = statSum;
86  m_texture = texture;
87 }
88 
90 {
91  m_outDsrc = outDsrc;
92  m_outDset = dsName;
93 }
94 
96 {
97  if (!m_inVectorDsType.get())
98  return false;
99 
100  if (!m_inVectorDsType->hasGeom())
101  return false;
102 
103  if (m_outDset.empty() || !m_outDsrc.get())
104  return false;
105 
106  return true;
107 }
108 
110 {
111 // prepare vector
112  te::gm::GeometryProperty* vectorProp = te::da::GetFirstGeomProperty(m_inVectorDsType.get());
113  std::auto_ptr<te::da::DataSet> dsVector = m_inVectorDsrc->getDataSet(m_inVectorName);
114 
115 // prepare raster
116  te::rst::RasterProperty* rasterProp = te::da::GetFirstRasterProperty(m_inRasterDsType.get());
117 
118  std::auto_ptr<te::da::DataSet> dsRaster = m_inRasterDsrc->getDataSet(m_inRasterName);
119  std::auto_ptr<te::rst::Raster> raster = dsRaster->getRaster(rasterProp->getName());
120  double resX = raster->getResolutionX();
121  double resY = raster->getResolutionY();
122 
123  te::gm::Envelope* env = raster->getExtent();
124 
125 // raster Attributes
126  te::rp::RasterAttributes* rasterAtt = 0;
127 
128 
129 // Parameters to get the percentage of classes by area
130  bool percentByArea = false;
131  std::vector<std::set<int> > pixelDistinct;
132  std::vector<te::stat::StatisticalSummary>::iterator it = std::find(m_statSum.begin(), m_statSum.end(), te::stat::PERCENT_EACH_CLASS_BY_AREA);
133  if (it != m_statSum.end())
134  {
135  pixelDistinct = getPixelDistinct(raster.get(), m_bands);
136  percentByArea = true;
137  }
138 
139 
140 // get output DataSetType.
141  std::auto_ptr<te::da::DataSetType> outDsType;
142  if (percentByArea)
143  outDsType = getDataSetType(pixelDistinct);
144  else
145  outDsType = getDataSetType();
146 // create the output dataset in memory
147  std::auto_ptr<te::mem::DataSet> outDataset(new te::mem::DataSet(outDsType.get()));
148 
149 
150 // task progress
151  te::common::TaskProgress task("Processing Operation...");
152  task.setTotalSteps((int)dsVector->size() * (int)m_statSum.size() * (int)m_bands.size());
153  task.useTimer(true);
154 
155 
156  dsVector->moveBeforeFirst();
157  while(dsVector->moveNext())
158  {
159  te::mem::DataSetItem* outDSetItem = new te::mem::DataSetItem(outDataset.get());
160 
161  std::vector<te::dt::Property*> vecProp = m_inVectorDsType->getProperties();
162  for(std::size_t i = 0; i < vecProp.size(); ++i)
163  {
164  outDSetItem->setValue(i, dsVector->getValue(i).release());
165  }
166 
167 // Geometry
168  std::auto_ptr<te::gm::Geometry> geom = dsVector->getGeometry(vectorProp->getName());
169  double area = 0;
170 
171 // Values from raster
172  std::vector<std::vector<double> > valuesFromRaster;
173  valuesFromRaster.resize(m_bands.size());
174 
175 // Contains
176  bool contains = true;
177 
178  if(geom->getGeomTypeId() == te::gm::MultiPolygonType)
179  {
180  te::gm::MultiPolygon* mPolygon = dynamic_cast< te::gm::MultiPolygon* >(geom.get());
181  contains = env->contains(*mPolygon->getMBR());
182 
183  if (percentByArea)
184  area = mPolygon->getArea();
185 
186  std::size_t n_geom = mPolygon->getNumGeometries();
187 
188  for(std::size_t n = 0; n < n_geom; ++n)
189  {
190  te::gm::Polygon* polygon = dynamic_cast< te::gm::Polygon* >(mPolygon->getGeometryN(n));
191  std::vector<std::vector<double> > tempValues = rasterAtt->getValuesFromRaster(*raster, *polygon, m_bands);
192 
193  for(std::size_t band = 0; band < tempValues.size(); ++band)
194  {
195  std::vector<double>::iterator it;
196  it = valuesFromRaster[band].end();
197 
198  valuesFromRaster[band].insert(it,
199  tempValues[band].begin(),
200  tempValues[band].end());
201  }
202  }
203  }
204  else if(geom->getGeomTypeId() == te::gm::PolygonType)
205  {
206  te::gm::Polygon* polygon = dynamic_cast< te::gm::Polygon* >(geom.get());
207  contains = env->contains(*polygon->getMBR());
208 
209  if (percentByArea)
210  area = polygon->getArea();
211 
212  valuesFromRaster = rasterAtt->getValuesFromRaster(*raster, *polygon, m_bands);
213 
214  }
215  else
216  {
217  return false;
218  }
219 
220  std::size_t init_index = m_inVectorDsType->getProperties().size();
221 
222 // Statistics set value
223  for(std::size_t band = 0; band < valuesFromRaster.size(); ++band)
224  {
225  te::stat::NumericStatisticalSummary summary = rasterAtt->getStatistics(valuesFromRaster[band]);
226 
227  if (percentByArea)
228  te::stat::GetPercentOfEachClassByArea(valuesFromRaster[band], resX, resY, area, summary, contains);
229 
230 
231  std::size_t current_index = init_index + m_statSum.size();
232 
233  for(std::size_t it = 0, i = init_index; i < current_index; ++it, ++i)
234  {
235  te::stat::StatisticalSummary ss = m_statSum[it];
236 
237  switch(ss)
238  {
239  case te::stat::MIN_VALUE:
240  outDSetItem->setDouble(i, summary.m_minVal);
241  break;
242  case te::stat::MAX_VALUE:
243  outDSetItem->setDouble(i, summary.m_maxVal);
244  break;
245  case te::stat::COUNT:
246  outDSetItem->setDouble(i, summary.m_count);
247  break;
249  outDSetItem->setDouble(i, summary.m_validCount);
250  break;
251  case te::stat::MEAN:
252  outDSetItem->setDouble(i, summary.m_mean);
253  break;
254  case te::stat::SUM:
255  outDSetItem->setDouble(i, summary.m_sum);
256  break;
258  outDSetItem->setDouble(i, summary.m_stdDeviation);
259  break;
260  case te::stat::VARIANCE:
261  outDSetItem->setDouble(i, summary.m_variance);
262  break;
263  case te::stat::SKEWNESS:
264  outDSetItem->setDouble(i, summary.m_skewness);
265  break;
266  case te::stat::KURTOSIS:
267  outDSetItem->setDouble(i, summary.m_kurtosis);
268  break;
269  case te::stat::AMPLITUDE:
270  outDSetItem->setDouble(i, summary.m_amplitude);
271  break;
272  case te::stat::MEDIAN:
273  outDSetItem->setDouble(i, summary.m_median);
274  break;
275  case te::stat::VAR_COEFF:
276  outDSetItem->setDouble(i, summary.m_varCoeff);
277  break;
278  case te::stat::MODE:
279  {
280  std::string mode;
281 
282  if (!summary.m_mode.empty())
283  {
284  mode = boost::lexical_cast<std::string>(summary.m_mode[0]);
285  for(std::size_t m=1; m<summary.m_mode.size(); ++m)
286  {
287  mode += ",";
288  mode += boost::lexical_cast<std::string>(summary.m_mode[m]);
289  }
290  outDSetItem->setString(i, mode);
291  }
292  else
293  {
294  outDSetItem->setString(i, "");
295  }
296  break;
297  }
299  {
300  std::set<int>::iterator itPixelDistinct = pixelDistinct[band].begin();
301  std::map<double, double>::iterator itPercent = summary.m_percentEachClass.begin();
302 
303  while (itPixelDistinct != pixelDistinct[band].end())
304  {
305  if (itPercent != summary.m_percentEachClass.end())
306  {
307  std::string name = outDSetItem->getPropertyName(i);
308  std::vector<std::string> splitString;
309  boost::split(splitString, name, boost::is_any_of("_"));
310  if (splitString[1] == boost::lexical_cast<std::string>(itPercent->first))
311  {
312  outDSetItem->setDouble(i, itPercent->second);
313  ++itPercent;
314  }
315  else
316  {
317  outDSetItem->setDouble(i, 0);
318  }
319  }
320  else
321  {
322  outDSetItem->setDouble(i, 0);
323  }
324  ++itPixelDistinct;
325  ++i;
326  }
327  current_index += pixelDistinct[band].size() - 1;
328  break;
329  }
330  default:
331  continue;
332  }
333  task.pulse();
334  }
335 
336  // texture
337  std::vector<te::rp::Texture> metrics;
338  init_index = current_index;
339 
340  if(m_texture == true)
341  {
342  metrics = getTexture(raster.get(), geom.get(), (int)m_bands.size());
343  current_index += 5;
344  for (std::size_t t = 0, i = init_index; i < current_index; ++t, ++i)
345  {
346  switch (t)
347  {
348  case 0:
349  {
350  outDSetItem->setDouble(i, metrics[band].m_contrast);
351  break;
352  }
353  case 1:
354  {
355  outDSetItem->setDouble(i, metrics[band].m_dissimilarity);
356  break;
357  }
358  case 2:
359  {
360  outDSetItem->setDouble(i, metrics[band].m_energy);
361  break;
362  }
363  case 3:
364  {
365  outDSetItem->setDouble(i, metrics[band].m_entropy);
366  break;
367  }
368  case 4:
369  {
370  outDSetItem->setDouble(i, metrics[band].m_homogeneity);
371  break;
372  }
373  }
374  }
375  }
376 
377  init_index = current_index;
378  }
379 
380  outDataset->add(outDSetItem);
381 
382  if (task.isActive() == false)
383  throw te::attributefill::Exception(TE_TR("Operation canceled!"));
384  }
385 
386  return save(outDataset,outDsType);
387 }
388 
389 std::vector<std::set<int> > te::attributefill::RasterToVector::getPixelDistinct(te::rst::Raster* rst, std::vector<unsigned int> bands)
390 {
391  std::vector<std::set<int> > pixelDistinct;
392  int numRows = rst->getNumberOfRows();
393  int numCols = rst->getNumberOfColumns();
394 
395  for (std::size_t b = 0; b < bands.size(); ++b)
396  {
397  std::set<int> pixelBandDistinct;
398 
399  for (int i = 0; i < numRows; ++i)
400  {
401  for (int j = 0; j < numCols; ++j)
402  {
403  double value;
404  rst->getValue(j, i, value, bands[b]);
405  pixelBandDistinct.insert((int)value);
406  }
407  }
408 
409  pixelDistinct.push_back(pixelBandDistinct);
410  }
411 
412  return pixelDistinct;
413 }
414 
415 std::auto_ptr<te::da::DataSetType> te::attributefill::RasterToVector::getDataSetType(std::vector<std::set<int> > pixelDistinct)
416 {
417  std::auto_ptr<te::da::DataSetType> outdsType(new te::da::DataSetType(*m_inVectorDsType));
418  outdsType->setCompositeName(m_outDset);
419  outdsType->setName(m_outDset);
420  outdsType->setTitle(m_outDset);
421 
422  te::da::PrimaryKey* pk = outdsType->getPrimaryKey();
423 
424  std::string name = pk->getName();
425  name += "_" + m_outDset;
426  pk->setName(name);
427 
428  for(std::size_t b = 0; b < m_bands.size(); ++b)
429  {
430  for(std::size_t i = 0; i < m_statSum.size(); ++i)
431  {
433  switch(m_statSum[i])
434  {
435  case 0:
436  prop = new te::dt::SimpleProperty("B"+ boost::lexical_cast<std::string>(m_bands[b]) +"_Min_Value", te::dt::DOUBLE_TYPE);
437  outdsType->add(prop);
438  break;
439  case 1:
440  prop = new te::dt::SimpleProperty("B"+ boost::lexical_cast<std::string>(m_bands[b]) +"_Max_Value", te::dt::DOUBLE_TYPE);
441  outdsType->add(prop);
442  break;
443  case 2:
444  prop = new te::dt::SimpleProperty("B"+ boost::lexical_cast<std::string>(m_bands[b]) +"_Mean", te::dt::DOUBLE_TYPE);
445  outdsType->add(prop);
446  break;
447  case 3:
448  prop = new te::dt::SimpleProperty("B"+ boost::lexical_cast<std::string>(m_bands[b]) +"_Sum", te::dt::DOUBLE_TYPE);
449  outdsType->add(prop);
450  break;
451  case 4:
452  prop = new te::dt::SimpleProperty("B"+ boost::lexical_cast<std::string>(m_bands[b]) +"_Count", te::dt::DOUBLE_TYPE);
453  outdsType->add(prop);
454  break;
455  case 5:
456  prop = new te::dt::SimpleProperty("B"+ boost::lexical_cast<std::string>(m_bands[b]) +"_Valid_Count", te::dt::DOUBLE_TYPE);
457  outdsType->add(prop);
458  break;
459  case 6:
460  prop = new te::dt::SimpleProperty("B"+ boost::lexical_cast<std::string>(m_bands[b]) +"_Standard_Deviation", te::dt::DOUBLE_TYPE);
461  outdsType->add(prop);
462  break;
463  case 7:
464  prop = new te::dt::SimpleProperty("B"+ boost::lexical_cast<std::string>(m_bands[b]) +"_Variance", te::dt::DOUBLE_TYPE);
465  outdsType->add(prop);
466  break;
467  case 8:
468  prop = new te::dt::SimpleProperty("B"+ boost::lexical_cast<std::string>(m_bands[b]) +"_Skewness", te::dt::DOUBLE_TYPE);
469  outdsType->add(prop);
470  break;
471  case 9:
472  prop = new te::dt::SimpleProperty("B"+ boost::lexical_cast<std::string>(m_bands[b]) +"_Kurtosis", te::dt::DOUBLE_TYPE);
473  outdsType->add(prop);
474  break;
475  case 10:
476  prop = new te::dt::SimpleProperty("B"+ boost::lexical_cast<std::string>(m_bands[b]) +"_Amplitude", te::dt::DOUBLE_TYPE);
477  outdsType->add(prop);
478  break;
479  case 11:
480  prop = new te::dt::SimpleProperty("B"+ boost::lexical_cast<std::string>(m_bands[b]) +"_Median", te::dt::DOUBLE_TYPE);
481  outdsType->add(prop);
482  break;
483  case 12:
484  prop = new te::dt::SimpleProperty("B"+ boost::lexical_cast<std::string>(m_bands[b]) +"_Var_Coeff", te::dt::DOUBLE_TYPE);
485  outdsType->add(prop);
486  break;
487  case 13:
488  prop = new te::dt::StringProperty("B"+ boost::lexical_cast<std::string>(m_bands[b]) +"_Mode");
489  outdsType->add(prop);
490  break;
491  case 14:
492  {
493  std::set<int>::iterator it = pixelDistinct[b].begin();
494  while (it != pixelDistinct[b].end())
495  {
496  prop = new te::dt::SimpleProperty("B"+ boost::lexical_cast<std::string>(m_bands[b]) +"_"+ boost::lexical_cast<std::string>(*it), te::dt::DOUBLE_TYPE);
497  outdsType->add(prop);
498  ++it;
499  }
500  }
501  break;
502  default:
503  continue;
504  }
505  }
506  if(m_texture == true)
507  {
508  te::dt::SimpleProperty* propContrast = new te::dt::SimpleProperty("B"+ boost::lexical_cast<std::string>(m_bands[b]) +"_Contrast", te::dt::DOUBLE_TYPE);
509  outdsType->add(propContrast);
510 
511  te::dt::SimpleProperty* propDissimilarity = new te::dt::SimpleProperty("B"+ boost::lexical_cast<std::string>(m_bands[b]) +"_Dissimilarity", te::dt::DOUBLE_TYPE);
512  outdsType->add(propDissimilarity);
513 
514  te::dt::SimpleProperty* propEnergy = new te::dt::SimpleProperty("B"+ boost::lexical_cast<std::string>(m_bands[b]) +"_Energy", te::dt::DOUBLE_TYPE);
515  outdsType->add(propEnergy);
516 
517  te::dt::SimpleProperty* propEntropy = new te::dt::SimpleProperty("B"+ boost::lexical_cast<std::string>(m_bands[b]) +"_Entropy", te::dt::DOUBLE_TYPE);
518  outdsType->add(propEntropy);
519 
520  te::dt::SimpleProperty* propHomogeneity = new te::dt::SimpleProperty("B"+ boost::lexical_cast<std::string>(m_bands[b]) +"_Homogeneity", te::dt::DOUBLE_TYPE);
521  outdsType->add(propHomogeneity);
522  }
523  }
524 
525  return outdsType;
526 }
527 
529  te::gm::Geometry* geom,
530  int bands)
531 {
532  te::rp::RasterAttributes rattributes;
533  std::vector<te::rp::Texture> textureVec;
534 
535  te::gm::Polygon* polygon;
536 
538  {
539  te::gm::MultiPolygon* mPolygon = dynamic_cast< te::gm::MultiPolygon* >(geom);
540  polygon = dynamic_cast< te::gm::Polygon* >(mPolygon->getGeometryN(0));
541  }
542  else
543  {
544  polygon = dynamic_cast< te::gm::Polygon* >(geom);
545  }
546 
547  for(int i = 0; i < bands; ++i)
548  {
549  boost::numeric::ublas::matrix<double> glcm = rattributes.getGLCM(*rst, i, 1, 1, *polygon);
550  te::rp::Texture metrics = rattributes.getGLCMMetrics(glcm);
551  textureVec.push_back(metrics);
552  }
553 
554  return textureVec;
555 }
556 
557 bool te::attributefill::RasterToVector::save(std::auto_ptr<te::mem::DataSet> result, std::auto_ptr<te::da::DataSetType> outDsType)
558 {
559  // do any adaptation necessary to persist the output dataset
560  te::da::DataSetTypeConverter* converter = new te::da::DataSetTypeConverter(outDsType.get(), m_outDsrc->getCapabilities());
561  te::da::DataSetType* dsTypeResult = converter->getResult();
562  std::auto_ptr<te::da::DataSetAdapter> dsAdapter(te::da::CreateAdapter(result.get(), converter));
563 
564  std::map<std::string, std::string> options;
565  // create the dataset
566  m_outDsrc->createDataSet(dsTypeResult, options);
567 
568  // copy from memory to output datasource
569  result->moveBeforeFirst();
570  m_outDsrc->add(dsTypeResult->getName(),result.get(), options);
571 
572  // create the primary key if it is possible
573  if (m_outDsrc->getCapabilities().getDataSetTypeCapabilities().supportsPrimaryKey())
574  {
575  std::string pk_name = dsTypeResult->getName() + "_pkey";
576  te::da::PrimaryKey* pk = new te::da::PrimaryKey(pk_name, dsTypeResult);
577  pk->add(dsTypeResult->getProperty(0));
578  m_outDsrc->addPrimaryKey(m_outDset,pk);
579  }
580 
581  return true;
582 }
virtual void setName(const std::string &name)
It sets the constraint name.
Definition: Constraint.h:126
std::size_t getNumGeometries() const
It returns the number of geometries in this GeometryCollection.
Mean.
Definition: Enums.h:43
TEDATAACCESSEXPORT te::rst::RasterProperty * GetFirstRasterProperty(const DataSetType *dt)
Definition: Utils.cpp:571
MultiPolygon is a MultiSurface whose elements are Polygons.
Definition: MultiPolygon.h:50
Geometric property.
A structure to hold the set of statistics from a set of numerical values.
void add(te::dt::Property *p)
It adds a property to the list of properties of the primary key.
Definition: PrimaryKey.h:123
std::vector< std::set< int > > getPixelDistinct(te::rst::Raster *rst, std::vector< unsigned int > bands)
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.
std::string getPropertyName(std::size_t pos) const
It returns the name of the pos-th property.
boost::shared_ptr< DataSource > DataSourcePtr
Definition: DataSource.h:1435
Skewness.
Definition: Enums.h:49
Total not null values.
Definition: Enums.h:46
Total number of values.
Definition: Enums.h:45
A class that models the description of a dataset.
Definition: DataSetType.h:72
unsigned int getNumberOfColumns() const
Returns the raster number of columns.
Definition: Raster.cpp:213
void useTimer(bool flag)
Used to define if task use progress timer information.
std::auto_ptr< te::da::DataSetType > getDataSetType(std::vector< std::set< int > > pixelDistinct=std::vector< std::set< int > >())
void setOutput(te::da::DataSourcePtr outDsrc, std::string dsName)
This class can be used to inform the progress of a task.
Definition: TaskProgress.h:53
void setValue(std::size_t i, te::dt::AbstractData *value)
It sets the value of the i-th property.
An exception class for the Attribute Fill module.
void setParams(std::vector< unsigned int > bands, std::vector< te::stat::StatisticalSummary > statSum, bool texture)
boost::numeric::ublas::matrix< double > getGLCM(const te::rst::Raster &rin, unsigned int band, int dx, int dy)
Computes the Gray-Level CoOccurrence Matrix (GLCM) from a raster band.
#define TE_TR(message)
It marks a string in order to get translated.
Definition: Translator.h:346
Percente of each class by area.
Definition: Enums.h:55
bool isActive() const
Verify if the task is active.
Raster property.
std::map< double, double > m_percentEachClass
Extraction of attributes from Raster, Bands, and Polygons.
std::vector< te::rp::Texture > getTexture(te::rst::Raster *rst, te::gm::Geometry *geom, int bands)
void setTotalSteps(int value)
Set the task total stepes.
Minimum value.
Definition: Enums.h:41
An converter for DataSetType.
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
Definition: DataSet.h:65
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
bool contains(const Envelope &rhs) const
It returns true if this envelope "spatially contains" the rhs envelope.
Definition: Envelope.h:535
Median.
Definition: Enums.h:52
An abstract class for raster data strucutures.
Definition: Raster.h:71
unsigned int getNumberOfRows() const
Returns the raster number of rows.
Definition: Raster.cpp:208
Raster to Vector processing.
std::vector< std::vector< double > > getValuesFromRaster(const te::rst::Raster &raster, const te::gm::Polygon &polygon, std::vector< unsigned int > bands)
Returns the pixel values for all the bands in raster, inside the polygon.
Kurtosis.
Definition: Enums.h:50
te::rp::Texture getGLCMMetrics(boost::numeric::ublas::matrix< double > glcm)
Compute texture metrics from GLCM matrix.
Standard deviation.
Definition: Enums.h:47
Sum of values.
Definition: Enums.h:44
void pulse()
Calls setCurrentStep() function using getCurrentStep() + 1.
The type for string types: FIXED_STRING, VAR_STRING or STRING.
void setInput(te::da::DataSourcePtr inRasterDsrc, std::string inRasterName, std::auto_ptr< te::da::DataSetType > inRasterDsType, te::da::DataSourcePtr inVectorDsrc, std::string inVectorName, std::auto_ptr< te::da::DataSetType > inVectorDsType)
GeomType getGeomTypeId() const
It returns the geometry subclass type identifier.
Definition: Geometry.h:178
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:73
te::stat::NumericStatisticalSummary getStatistics(std::vector< double > &pixels)
Returns several statistics from a set of pixels.
Coefficient variation.
Definition: Enums.h:53
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.
Definition: Raster.cpp:228
double getArea() const
It returns the area of this surface, as measured in the spatial reference system of this surface...
Geometry * getGeometryN(std::size_t i) const
It returns the n-th geometry in this GeometryCollection.
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver...
Definition: DataSetItem.h:56
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:50
double getArea() const
It returns the area of this MultiSurface, as measured in the spatial reference system of this multisu...
bool save(std::auto_ptr< te::mem::DataSet > result, std::auto_ptr< te::da::DataSetType > outDsType)
It describes a primary key (pk) constraint.
Definition: PrimaryKey.h:52
Mode.
Definition: Enums.h:54
A structure to hold the set of GLCM metrics.
Definition: Texture.h:44
StatisticalSummary
Define grouping functions type.
Definition: Enums.h:39
void setString(std::size_t i, const std::string &value)
It sets the value of the i-th property.
virtual const std::string & getName() const
It returns the constraint name.
Definition: Constraint.h:119
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
Definition: Utils.cpp:557
TEDATAACCESSEXPORT DataSetAdapter * CreateAdapter(DataSet *ds, DataSetTypeConverter *converter, bool isOwner=false)
Definition: Utils.cpp:644
Variance.
Definition: Enums.h:48
Maximum value.
Definition: Enums.h:42
const Envelope * getMBR() const
It returns the minimum bounding rectangle for the geometry in an internal representation.
Definition: Geometry.cpp:104
TESTATEXPORT void GetPercentOfEachClassByArea(std::vector< double > &values, double &resolutionX, double &resolutionY, double &area, te::stat::NumericStatisticalSummary &ss, bool fullIntersection=true)
Amplitude.
Definition: Enums.h:51
const std::string & getName() const
It returns the property name.
Definition: Property.h:127