29 #include "terralib_config.h"
30 #include "../common/Logger.h"
31 #include "../common/progress/TaskProgress.h"
32 #include "../common/STLUtils.h"
33 #include "../common/StringUtils.h"
34 #include "../common/Translator.h"
35 #include "../dataaccess/utils/Utils.h"
36 #include "../datatype/StringProperty.h"
37 #include "../datatype/SimpleData.h"
38 #include "../geometry.h"
39 #include "../memory/DataSet.h"
40 #include "../memory/DataSetItem.h"
41 #include "../statistics/core/NumericStatisticalSummary.h"
42 #include "../statistics/core/StringStatisticalSummary.h"
43 #include "../statistics/core/SummaryFunctions.h"
44 #include "../statistics/core/Enums.h"
53 #include <boost/algorithm/string/replace.hpp>
54 #include <boost/lexical_cast.hpp>
58 std::string invalidChar;
64 boost::replace_all(name,
"/",
"_");
65 boost::replace_all(name,
" ",
"_");
66 boost::replace_all(name,
".",
"");
67 boost::replace_all(name,
"'",
"");
84 std::auto_ptr<te::da::DataSet> fromDs = m_fromLayer->getData();
85 int fromSrid = m_fromLayer->getSRID();
86 std::auto_ptr<te::da::DataSetType> fromSchema = m_fromLayer->getSchema();
89 std::auto_ptr<te::da::DataSet> toDs = m_toLayer->getData();
90 std::auto_ptr<te::da::DataSetType> toSchema = m_toLayer->getSchema();
91 int toSrid = m_toLayer->getSRID();
98 std::auto_ptr<te::da::DataSetType> outDst(getOutputDataSetType());
105 toDs->moveBeforeFirst();
111 std::string logInfo1 =
"";
112 std::string logInfo2 =
"";
113 while(toDs->moveNext())
119 std::vector<te::dt::Property*> outProps = outDst->getProperties();
120 std::vector<te::dt::Property*> toProps = toSchema->getProperties();
121 for(std::size_t i = 0; i < outProps.size(); ++i)
123 std::string outPropName = outProps[i]->getName();
125 for(std::size_t j = 0; j < toProps.size(); ++j)
127 if(toProps[j]->getName() == outPropName)
129 item->
setValue(outPropName, toDs->getValue(outPropName).release());
135 std::vector<std::size_t> intersections = getIntersections(toDs.get(), fromDs.get(), rtree);
137 if(intersections.empty() && !hasNoIntersectionOperations())
143 std::map<std::string, std::vector<te::attributefill::OperationType> >::iterator it = m_options.begin();
145 while(it != m_options.end())
147 logInfo1 = it->first;
154 std::vector<double> numValues;
155 std::vector<std::string> strValues;
156 std::vector<te::dt::AbstractData*> dataValues;
158 dataValues = getDataValues(fromDs.get(), intersections, prop->
getName());
162 strValues = getStrValues(dataValues);
167 numValues = getNumValues(dataValues);
171 std::vector<te::attributefill::OperationType> funcs = it->second;
173 for(std::size_t i = 0; i < funcs.size(); ++i)
176 std::string outPropName = getPropertyName(prop, funcs[i]);
187 te::dt::AbstractData* value = getClassWithHighestIntersectionArea(toDs.get(), toSrid, fromDs.get(), fromSrid, intersections, prop->
getName());
198 std::map<std::string, double> result = getPercentagePerClass(fromDs.get(), intersections, prop->
getName());
200 std::map<std::string, double>::iterator itAux = result.begin();
201 while(itAux != result.end())
203 std::string className = itAux->first;
204 normalizeClassName(className);
205 std::string newPropName = prop->
getName() +
"_" + className;
207 item->
setDouble(newPropName, itAux->second);
214 if(intersections.size() > 0)
225 double area = getPercentageOfTotalArea(toDs.get(), toSrid, fromDs.get(), fromSrid, intersections, prop->
getName());
231 std::map<std::string, double> result = getPercentageOfEachClassByArea(toDs.get(), toSrid, fromDs.get(), fromSrid, intersections, prop->
getName());
233 std::map<std::string, double>::iterator itAux = result.begin();
234 while(itAux != result.end())
236 std::string className = itAux->first;
237 normalizeClassName(className);
238 std::string newPropName = prop->
getName() +
"_" + className;
240 item->
setDouble(newPropName, itAux->second);
247 double weigh = getWeightedByArea(toDs.get(), toSrid, fromDs.get(), fromSrid, intersections, prop->
getName());
253 double weigh = getWeightedSumByArea(toDs.get(), toSrid, fromDs.get(), fromSrid, intersections, prop->
getName());
261 if(intersections.empty())
264 kdtree = getKDtree(fromDs.get(), toSrid);
266 result = getMinimumDistance(toDs.get(), toSrid, fromDs.get(), fromSrid, kdtree);
271 else if(isStatistical(funcs[i]))
275 std::string value = getValue(ssStr, funcs[i]);
282 std::string value = getModeValue(ssNum);
287 double value = getValue(ssNum, funcs[i]);
311 #ifdef TERRALIB_LOGGER_ENABLED
312 std::string ex = e.
what();
313 ex +=
" | Ref: " + logInfo1 +
" : " + logInfo2;
314 te::common::Logger::logDebug(
"attributefill", ex.c_str());
315 #endif //TERRALIB_LOGGER_ENABLED
319 catch(std::exception& e)
321 #ifdef TERRALIB_LOGGER_ENABLED
322 std::string ex = e.what();
323 ex +=
" | Ref: " + logInfo1 +
" : " + logInfo2;
324 te::common::Logger::logDebug(
"attributefill", ex.c_str());
325 #endif //TERRALIB_LOGGER_ENABLED
343 std::auto_ptr<te::da::DataSet> fromDs = m_fromLayer->getData();
344 std::auto_ptr<te::da::DataSetType> fromSchema = m_fromLayer->getSchema();
346 std::auto_ptr<te::da::DataSetType> toScheme = m_toLayer->getSchema();
351 std::vector<te::dt::Property*> outProps = dst->
getProperties();
355 for(std::size_t i = 0; i < outProps.size(); ++i)
358 for(std::size_t j = 0; j < pkProps.size(); ++j)
360 if(outProps[i]->getName() == pkProps[j]->getName())
369 std::string name = outProps[i]->getName();
370 if(std::find(m_toLayerProps.begin(), m_toLayerProps.end(), name) == m_toLayerProps.end())
375 std::map<std::string, std::vector<te::attributefill::OperationType> >::iterator it = m_options.begin();
377 while(it != m_options.end())
381 std::vector<te::attributefill::OperationType> funcs = it->second;
383 for(std::size_t i = 0; i < funcs.size(); ++i)
431 std::vector<std::string> strClasses = getDistinctClasses(fromDs.get(), currentProperty->
getName());
433 for(std::size_t i = 0; i < strClasses.size(); ++i)
435 std::string className = strClasses[i];
437 normalizeClassName(className);
439 std::string newPropName = currentProperty->
getName() +
"_" + className;
454 const std::string& propertyName)
456 std::vector<std::string> result;
462 std::string strClass = fromDs->
getAsString(propertyName, 9);
464 if(std::find(result.begin(), result.end(), strClass) == result.end())
466 result.push_back(strClass);
485 std::auto_ptr<te::gm::Geometry> geom = data->
getGeometry(geomPos);
487 rtree->
insert(*geom->getMBR(), count);
499 std::string newName = name +
"_";
504 newName +=
"min_val";
506 newName +=
"max_val";
510 newName +=
"sum_values";
512 newName +=
"total_values";
514 newName +=
"total_notnull_values";
516 newName +=
"stand_dev";
518 newName +=
"variance";
520 newName +=
"skewness";
522 newName +=
"kurtosis";
524 newName +=
"amplitude";
528 newName +=
"coeff_variation";
532 newName +=
"class_high_occurrence";
534 newName +=
"class_high_area";
536 newName +=
"min_distance";
538 newName +=
"presence";
540 newName +=
"percent_of_total_area";
542 newName +=
"percent_area_class";
544 newName +=
"weigh_area";
546 newName +=
"weigh_sum_area";
548 newName +=
"percent_class";
560 std::map<std::size_t, std::vector<std::size_t> > intersections;
562 std::auto_ptr<te::gm::Geometry> geom = toDs->
getGeometry(toSpatialPos);
563 geom->setSRID(m_toLayer->getSRID());
565 std::vector<size_t> report;
566 rtree->
search(*geom->getMBR(), report);
568 std::vector<std::size_t> interVec;
569 for(std::size_t i = 0; i < report.size(); ++i)
571 fromDs->
move(report[i]);
573 std::auto_ptr<te::gm::Geometry> g = fromDs->
getGeometry(fromSpatialPos);
574 g->setSRID(m_fromLayer->getSRID());
576 if(geom->intersects(g.get()))
578 interVec.push_back(report[i]);
586 std::vector<double> result;
588 for(std::size_t i = 0; i < data.size(); ++i)
592 result.push_back(0.0f);
609 std::string strValue = data[i]->toString();
611 result.push_back(boost::lexical_cast<double>(strValue));
620 std::vector<std::string> result;
622 for(std::size_t i = 0; i < data.size(); ++i)
626 result.push_back(
"");
631 result.push_back(data[i]->toString());
701 return boost::lexical_cast<std::string>(ss.
m_count);
703 return boost::lexical_cast<std::string>(ss.
m_validCount);
710 std::string result =
"";
711 std::vector<double> values = ss.
m_mode;
712 for(std::size_t i = 0; i < values.size(); ++i)
715 result += boost::lexical_cast<std::string>(values[i]);
717 result +=
", " + boost::lexical_cast<std::string>(values[i]);
724 std::vector<std::size_t> dsPos,
725 const std::string& propertyName)
727 std::vector<te::dt::AbstractData*> result;
729 for(std::size_t i = 0; i < dsPos.size(); ++i)
731 fromDs->
move(dsPos[i]);
732 if(fromDs->
isNull(propertyName))
735 result.push_back(fromDs->
getValue(propertyName).release());
742 std::vector<std::size_t> dsPos,
743 const std::string& propertyName)
748 std::map<std::string, std::size_t> counter;
749 for(std::size_t i = 0; i < dsPos.size(); ++i)
751 fromDs->
move(dsPos[i]);
753 std::string value = fromDs->
getAsString(propIndex);
755 if(counter.find(value) == counter.end())
761 std::size_t aux = counter[value] + 1;
762 counter[value] = aux;
766 std::map<std::string, std::size_t>::iterator it = counter.begin();
769 while(it != counter.end())
781 std::size_t aux2 = 0;
782 it = counter.begin();
783 while(it != counter.end())
785 if(it->second == aux)
794 data = getDataBasedOnType(value, propType);
807 std::size_t fromSrid,
808 std::vector<std::size_t> dsPos,
809 const std::string& propertyName)
817 std::auto_ptr<te::gm::Geometry> toGeom = toDs->
getGeometry(toGeomPos);
818 if(toGeom->getSRID() <= 0)
819 toGeom->setSRID(toSrid);
821 std::map<std::string, double> classAreaMap;
822 for(std::size_t i = 0; i < dsPos.size(); ++i)
824 fromDs->
move(dsPos[i]);
826 std::auto_ptr<te::gm::Geometry> fromGeom = fromDs->
getGeometry(fromGeomPos);
827 if(fromGeom->getSRID() <= 0)
828 fromGeom->setSRID(fromSrid);
830 std::auto_ptr<te::gm::Geometry> interGeom;
832 if(!checkGeometries(fromGeom.get(), dsPos[i], toGeom.get()))
840 interGeom.reset(toGeom->intersection(fromGeom.get()));
842 catch(
const std::exception &e)
844 #ifdef TERRALIB_LOGGER_ENABLED
845 std::string ex = e.what();
846 te::common::Logger::logDebug(
"attributefill", ex.c_str());
847 #endif //TERRALIB_LOGGER_ENABLED
852 std::string value = fromDs->
getAsString(propertyName);
854 double area = getArea(interGeom.get());
856 if(classAreaMap.find(value) == classAreaMap.end())
858 classAreaMap[value] = area;
862 double aux = classAreaMap[value];
863 classAreaMap[value] = aux + area;
867 std::map<std::string, double>::iterator it = classAreaMap.begin();
870 while(it != classAreaMap.end())
887 std::vector<std::size_t> dsPos,
888 const std::string& propertyName)
890 std::map<std::string, double> result;
892 std::map<std::string, std::size_t> aux;
893 for(std::size_t i = 0; i < dsPos.size(); ++i)
895 fromDs->
move(dsPos[i]);
897 std::string value = fromDs->
getAsString(propertyName);
899 if(aux.find(value) == aux.end())
909 std::size_t total = 0;
910 std::map<std::string, std::size_t>::iterator it = aux.begin();
911 while(it != aux.end())
919 while(it != aux.end())
921 std::string normName = it->first;
922 normalizeClassName(normName);
923 result[normName] = ((double)it->second / total);
934 std::size_t fromSrid,
935 std::vector<std::size_t> dsPos,
936 const std::string& propertyName)
941 std::auto_ptr<te::gm::Geometry> toGeom = toDs->
getGeometry(toGeomPos);
942 if(toGeom->getSRID() <= 0)
943 toGeom->setSRID(toSrid);
945 double classArea = 0;
946 for(std::size_t i = 0; i < dsPos.size(); ++i)
948 fromDs->
move(dsPos[i]);
950 std::auto_ptr<te::gm::Geometry> fromGeom = fromDs->
getGeometry(fromGeomPos);
951 if(fromGeom->getSRID() <= 0)
952 fromGeom->setSRID(fromSrid);
954 if(checkGeometries(fromGeom.get(), dsPos[i], toGeom.get()))
960 std::auto_ptr<te::gm::Geometry> interGeom(toGeom->intersection(fromGeom.get()));
962 classArea += getArea(interGeom.get());
965 double polArea = getArea(toGeom.get());
967 return classArea/polArea;
973 std::size_t fromSrid,
974 std::vector<std::size_t> dsPos,
975 const std::string& propertyName)
977 std::map<std::string, double> result;
982 std::auto_ptr<te::gm::Geometry> toGeom = toDs->
getGeometry(toGeomPos);
983 if(toGeom->getSRID() <= 0)
984 toGeom->setSRID(toSrid);
986 double toGeomArea = getArea(toGeom.get());
988 for(std::size_t i = 0; i < dsPos.size(); ++i)
990 fromDs->
move(dsPos[i]);
992 std::auto_ptr<te::gm::Geometry> fromGeom = fromDs->
getGeometry(fromGeomPos);
993 if(fromGeom->getSRID() <= 0)
994 fromGeom->setSRID(fromSrid);
996 if(checkGeometries(fromGeom.get(), dsPos[i], toGeom.get()))
1002 std::auto_ptr<te::gm::Geometry> interGeom(toGeom->intersection(fromGeom.get()));
1004 std::string value = fromDs->
getAsString(propertyName);
1006 double area = getArea(interGeom.get());
1008 if(result.find(value) == result.end())
1010 result[value] = area/toGeomArea;
1014 result[value] += area/toGeomArea;
1024 std::size_t fromSrid,
1025 std::vector<std::size_t> dsPos,
1026 const std::string& propertyName)
1031 std::auto_ptr<te::gm::Geometry> toGeom = toDs->
getGeometry(toGeomPos);
1032 if(toGeom->getSRID() <= 0)
1033 toGeom->setSRID(toSrid);
1035 double toGeomArea = getArea(toGeom.get());
1039 for(std::size_t i = 0; i < dsPos.size(); ++i)
1041 fromDs->
move(dsPos[i]);
1043 std::auto_ptr<te::gm::Geometry> fromGeom = fromDs->
getGeometry(fromGeomPos);
1044 if(fromGeom->getSRID() <= 0)
1045 fromGeom->setSRID(fromSrid);
1047 if(checkGeometries(fromGeom.get(), dsPos[i], toGeom.get()))
1053 std::auto_ptr<te::gm::Geometry> interGeom(toGeom->intersection(fromGeom.get()));
1055 double value_num = 0;
1057 if(!fromDs->
isNull(propertyName))
1059 std::string value = fromDs->
getAsString(propertyName);
1060 value_num = boost::lexical_cast<
double>(value);
1063 double intersectionArea = getArea(interGeom.get());
1065 weigh += value_num*(intersectionArea/toGeomArea);
1074 std::size_t fromSrid,
1075 std::vector<std::size_t> dsPos,
1076 const std::string& propertyName)
1081 std::auto_ptr<te::gm::Geometry> toGeom = toDs->
getGeometry(toGeomPos);
1082 if(toGeom->getSRID() <= 0)
1083 toGeom->setSRID(toSrid);
1087 for(std::size_t i = 0; i < dsPos.size(); ++i)
1089 fromDs->
move(dsPos[i]);
1091 std::auto_ptr<te::gm::Geometry> fromGeom = fromDs->
getGeometry(fromGeomPos);
1092 if(fromGeom->getSRID() <= 0)
1093 fromGeom->setSRID(fromSrid);
1095 double fromGeomArea = getArea(fromGeom.get());
1097 if(checkGeometries(fromGeom.get(), dsPos[i], toGeom.get()))
1103 std::auto_ptr<te::gm::Geometry> interGeom(toGeom->intersection(fromGeom.get()));
1105 double value_num = 0;
1107 if(!fromDs->
isNull(propertyName))
1109 std::string value = fromDs->
getAsString(propertyName);
1110 value_num = boost::lexical_cast<
double>(value);
1113 double intersectionArea = getArea(interGeom.get());
1115 weigh += value_num*(intersectionArea/fromGeomArea);
1290 std::vector<std::pair<te::gm::Coord2D, te::gm::Point> > kdset;
1296 std::auto_ptr<te::gm::Geometry> geom = data->
getGeometry(geomPos);
1298 std::vector<te::gm::Point*> allPoints = getAllPointsOfGeometry(geom.get());
1300 for(std::size_t i = 0; i < allPoints.size(); ++i)
1310 kdset.push_back(std::pair<te::gm::Coord2D, te::gm::Point>(coord, *p));
1314 kdtree->
build(kdset);
1322 std::size_t fromSrid,
1326 std::auto_ptr<te::gm::Geometry> toGeom = toDs->
getGeometry(toGeomPos);
1328 std::vector<te::gm::Point*> allPoints = getAllPointsOfGeometry(toGeom.get());
1330 std::vector<double> distances;
1332 for(std::size_t i = 0; i < allPoints.size(); ++i)
1336 std::vector<te::gm::Point> points;
1337 points.push_back(
te::gm::Point(std::numeric_limits<double>::max(), std::numeric_limits<double>::max()));
1338 std::vector<double> sqrDists;
1342 distances.push_back(sqrDists[0]);
1345 double finalResult = std::numeric_limits<double>::max();
1346 for(std::size_t i = 0; i < distances.size(); ++i)
1348 if(distances[i] < finalResult)
1349 finalResult = distances[i];
1352 return sqrt(finalResult);
1359 std::vector<te::gm::Point*> result;
1366 result.push_back(g);
1376 std::vector<te::gm::Point*> vec = getAllPointsOfGeometry(gAux);
1377 result.insert(result.end(), vec.begin(), vec.end());
1392 for(std::size_t j = 0; j < lr->
getNPoints(); ++j)
1408 std::vector<te::gm::Point*> vec = getAllPointsOfGeometry(gAux);
1409 result.insert(result.end(), vec.begin(), vec.end());
1417 for(std::size_t i = 0; i < g->
getNPoints(); ++i)
1432 std::vector<te::gm::Point*> vec = getAllPointsOfGeometry(gAux);
1433 result.insert(result.end(), vec.begin(), vec.end());
1440 return std::vector<te::gm::Point*>();
1449 std::map<std::string, std::vector<te::attributefill::OperationType> >::iterator it = m_options.begin();
1451 while(it != m_options.end())
1453 std::vector<te::attributefill::OperationType> ops = it->second;
1455 for(std::size_t i = 0; i < ops.size(); ++i)
1471 std::string ex =
TE_TR(
"\"From\" layer geometry at position ");
1472 ex += boost::lexical_cast<std::string>(fromPos);
1473 ex +=
TE_TR(
" is invalid.");
1474 #ifdef TERRALIB_LOGGER_ENABLED
1475 te::common::Logger::logDebug(
"attributefill", ex.c_str());
1476 #endif //TERRALIB_LOGGER_ENABLED
1482 std::string ex =
TE_TR(
"\"To\" layer geometry is invalid.");
1483 #ifdef TERRALIB_LOGGER_ENABLED
1484 te::common::Logger::logDebug(
"attributefill", ex.c_str());
1485 #endif //TERRALIB_LOGGER_ENABLED
void normalizeClassName(std::string &name)
VectorToVectorMemory()
Constructor.
TESTATEXPORT void GetNumericStatisticalSummary(std::vector< double > &values, te::stat::NumericStatisticalSummary &ss, double nullVal)
std::vector< te::gm::Point * > getAllPointsOfGeometry(te::gm::Geometry *geom)
It get all points of a geometry.
double getValue(te::stat::NumericStatisticalSummary ss, te::attributefill::OperationType type)
It get the value of required operation type from numeric statistical summary.
std::size_t getNumRings() const
It returns the number of rings in this CurvePolygon.
std::size_t getNumGeometries() const
It returns the number of geometries in this GeometryCollection.
void transform(int srid)
It converts the coordinate values of the point to the new spatial reference system.
bool isStatistical(te::attributefill::OperationType type)
It verify if the operation is a statistical operation.
int getSRID() const
It returns the Spatial Reference System ID associated to this geometric object.
MultiPolygon is a MultiSurface whose elements are Polygons.
A structure to hold the set of statistics from a set of numerical values.
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
std::vector< te::dt::AbstractData * > getDataValues(te::da::DataSet *fromDs, std::vector< std::size_t > dsPos, const std::string &propertyName)
It get the value of all positions in "To" data set that has intersection with a position of "From" da...
Configuration flags for the Attribute Fill module of TerraLib.
std::vector< std::string > getStrValues(std::vector< te::dt::AbstractData * > data)
It get the string values of a vector of abstract data.
void setDouble(std::size_t i, double value)
It sets the value of the i-th property.
bool intersects(const Envelope &rhs) const
It returns true if the envelopes "spatially intersects".
An atomic property like an integer or double.
std::string Convert2LCase(const std::string &value)
It converts a string to lower case.
A class that represents an R-tree.
A class that models the description of a dataset.
Curve is an abstract class that represents 1-dimensional geometric objects stored as a sequence of co...
virtual const char * what() const
It outputs the exception message.
void useTimer(bool flag)
Used to define if task use progress timer information.
te::dt::AbstractData * getDataBasedOnType(const std::string &strValue, const int type)
It get a abstract data with the value based on the type.
Point * getPointN(std::size_t i) const
It returns the specified point in this LineString.
A class that represents a two dimensional K-d Tree (2-d Tree) that store data-elements into the leafs...
virtual Property * clone() const =0
It returns a clone of the object.
This class can be used to inform the progress of a task.
void setValue(std::size_t i, te::dt::AbstractData *value)
It sets the value of the i-th property.
std::vector< double > m_mode
PrimaryKey * getPrimaryKey() const
It returns the primary key associated to the dataset type.
An utility struct for representing 2D coordinates.
bool checkGeometries(te::gm::Geometry *fromGeom, std::size_t fromPos, te::gm::Geometry *toGeom)
#define TE_TR(message)
It marks a string in order to get translated.
std::string ReplaceSpecialChars(const std::string &str, bool &changed)
It replace special characters of a string.
It models a property definition.
TEDATAACCESSEXPORT int GetPropertyIndex(te::da::DataSet *dataSet, const std::string propName)
bool isActive() const
Verify if the task is active.
double getPercentageOfTotalArea(te::da::DataSet *toDs, std::size_t toSrid, te::da::DataSet *fromDs, std::size_t fromSrid, std::vector< std::size_t > dsPos, const std::string &propertyName)
It get the percentage of intersection area in the total area.
const std::vector< te::dt::Property * > & getProperties() const
It returns the properties that take part of the primary key.
virtual bool move(std::size_t i)=0
It moves the dataset internal pointer to a given position.
void setTotalSteps(int value)
Set the task total stepes.
std::string getPropertyName(te::dt::Property *prop, te::attributefill::OperationType func)
It return a name based on original property name and the selected operation.
Vector to Vector processing.
void setInt32(std::size_t i, boost::int32_t value)
It sets the value of the i-th property.
virtual bool moveNext()=0
It moves the internal pointer to the next item of the collection.
std::vector< double > getNumValues(std::vector< te::dt::AbstractData * > data)
It get the numeric values of a vector of abstract data.
A LinearRing is a LineString that is both closed and simple.
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
virtual int code() const
It gets the exception code.
void setName(const std::string &name)
It sets the property name.
MultiPoint is a GeometryCollection whose elements are restricted to points.
void remove(Constraint *c)
It removes the constraint.
TEDATAACCESSEXPORT std::size_t GetFirstSpatialPropertyPos(const te::da::DataSet *dataset)
It returns the first dataset spatial property or NULL if none is found.
const std::vector< Property * > & getProperties() const
It returns the list of properties describing the CompositeProperty.
LineString is a curve with linear interpolation between points.
bool isMultiPoint(te::gm::GeomType type)
It verify if the geometry is a multi point.
const double & getY() const
It returns the Point y-coordinate value.
A point with x and y coordinate values.
double getWeightedSumByArea(te::da::DataSet *toDs, std::size_t toSrid, te::da::DataSet *fromDs, std::size_t fromSrid, std::vector< std::size_t > dsPos, const std::string &propertyName)
It get the sum of weighted average if intersections values.
An Envelope defines a 2D rectangular region.
void build(std::vector< std::pair< kdKey, kdDataItem > > &dataSet)
It inserts the data set into the tree.
std::vector< std::size_t > getIntersections(te::da::DataSet *toDs, te::da::DataSet *fromDs, te::sam::rtree::Index< size_t, 8 > *rtree)
It verify all intersection between the "From" and "To" data sets.
virtual bool isNull(std::size_t i) const =0
It checks if the attribute value is NULL.
te::sam::kdtree::AdaptativeIndex< KD_ADAPTATIVE_NODE > KD_ADAPTATIVE_TREE
bool hasNoIntersectionOperations()
Verify if has operations that don't need the intersections.
KD_ADAPTATIVE_TREE * getKDtree(te::da::DataSet *data, std::size_t toSrid)
It return a KDTree.
std::size_t getNPoints() const
It returns the number of points (vertexes) in the linestring.
void pulse()
Calls setCurrentStep() function using getCurrentStep() + 1.
virtual std::string getAsString(std::size_t i, int precision=0) const
Method for retrieving a data value as a string plain representation.
A base class for values that can be retrieved from the data access module.
virtual bool isValid() const
It tells if the geometry is well formed.
The type for string types: FIXED_STRING, VAR_STRING or STRING.
std::string getModeValue(te::stat::NumericStatisticalSummary ss)
It get a string with the mode operation format.
int search(const te::gm::Envelope &mbr, std::vector< DATATYPE > &report) const
Range search query.
double getWeightedByArea(te::da::DataSet *toDs, std::size_t toSrid, te::da::DataSet *fromDs, std::size_t fromSrid, std::vector< std::size_t > dsPos, const std::string &propertyName)
It get the weighted average if intersections values.
GeomType getGeomTypeId() const
It returns the geometry subclass type identifier.
std::vector< std::string > getDistinctClasses(te::da::DataSet *fromDs, const std::string &propertyName)
It return distincts values of a property from the "From" data set.
TESTATEXPORT void GetStringStatisticalSummary(std::vector< std::string > &values, te::stat::StringStatisticalSummary &ss)
std::map< std::string, double > getPercentagePerClass(te::da::DataSet *fromDs, std::vector< std::size_t > dsPos, const std::string &propertyName)
It get the percent per class from "From" data set in "To" data set.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
virtual std::auto_ptr< te::gm::Geometry > getGeometry(std::size_t i) const =0
Method for retrieving a geometric attribute value.
te::dt::AbstractData * getClassWithHighestOccurrence(te::da::DataSet *fromDs, std::vector< std::size_t > dsPos, const std::string &propertyName)
It get the class with highest occurrence from "From" data set in "To" data set.
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.
int getType() const
It returns the property data type.
void add(Constraint *c)
It adds a new constraint.
MultiLineString is a MultiCurve whose elements are LineStrings.
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.
bool run()
It execute the operations.
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
double getArea() const
It returns the area of this MultiSurface, as measured in the spatial reference system of this multisu...
bool isLine(te::gm::GeomType type)
It verify if the geometry is a line.
void insert(const te::gm::Envelope &mbr, const DATATYPE &data)
It inserts an item into the tree.
A structure to hold the set of statistics from a set of categorical (sample) values.
virtual std::auto_ptr< te::gm::Envelope > getExtent(std::size_t i)=0
It computes the bounding rectangle for a spatial property of the dataset.
TEDATAACCESSEXPORT bool IsValidName(const std::string &name, std::string &invalidChar)
It checks if the name is not valid as the existence of invalid characters, reserved words...
virtual bool moveBeforeFirst()=0
It moves the internal pointer to a position before the first item in the collection.
void setRequired(bool r)
It tells if the property is required or not.
bool isPolygon(te::gm::GeomType type)
It verify if the geometry is a polygon.
te::da::DataSetType * getOutputDataSetType()
It create a data set type based on selecteds properties and operations.
te::dt::AbstractData * getClassWithHighestIntersectionArea(te::da::DataSet *toDs, std::size_t toSrid, te::da::DataSet *fromDs, std::size_t fromSrid, std::vector< std::size_t > dsPos, const std::string &propertyName)
It get the class with highest intersection area from "From" data set in "To" data set...
bool isMultiLine(te::gm::GeomType type)
It verify if the geometry is a multi line.
A template for atomic data types (integers, floats, strings and others).
void setString(std::size_t i, const std::string &value)
It sets the value of the i-th property.
bool isPoint(te::gm::GeomType type)
It verify if the geometry is a point.
It is a collection of other geometric objects.
double getMinimumDistance(te::da::DataSet *toDs, std::size_t toSrid, te::da::DataSet *fromDs, std::size_t fromSrid, KD_ADAPTATIVE_TREE *kdtree)
It get the minimum distance of objects that not intersect.
virtual int getPropertyDataType(std::size_t i) const =0
It returns the underlying data type of the property at position pos.
void nearestNeighborSearch(const kdKey &key, std::vector< kdDataItem > &report, std::vector< double > &sqrDists, const std::size_t &k) const
It searches the nearest data in nodes: you must pass an array of kdDataItem of size "k" with coordina...
double getArea(te::gm::Geometry *geom)
It get the area of a geometry.
OperationType
Define grouping operations type.
std::map< std::string, double > getPercentageOfEachClassByArea(te::da::DataSet *toDs, std::size_t toSrid, te::da::DataSet *fromDs, std::size_t fromSrid, std::vector< std::size_t > dsPos, const std::string &propertyName)
It get the percentage of each class intersection area in the total area.
const double & getX() const
It returns the Point x-coordinate value.
bool isMultiPolygon(te::gm::GeomType type)
It verify if the geometry is a multi polygon.
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.
Curve * getRingN(std::size_t i) const
It returns the n-th ring for this curve polygon as a curve.
const std::string & getName() const
It returns the property name.
te::sam::rtree::Index< size_t, 8 > * getRtree(te::da::DataSet *data)
It return a RTree with data set iterator position information.