29 #include "../core/logger/Logger.h" 30 #include "../common/progress/TaskProgress.h" 31 #include "../common/STLUtils.h" 32 #include "../common/StringUtils.h" 33 #include "../core/translator/Translator.h" 34 #include "../dataaccess/dataset/DataSetAdapter.h" 35 #include "../dataaccess/dataset/DataSetTypeConverter.h" 36 #include "../dataaccess/datasource/DataSourceInfo.h" 37 #include "../dataaccess/datasource/DataSourceInfoManager.h" 38 #include "../dataaccess/utils/Utils.h" 39 #include "../datatype/StringProperty.h" 40 #include "../datatype/SimpleData.h" 41 #include "../geometry.h" 42 #include "../memory/DataSet.h" 43 #include "../memory/DataSetItem.h" 44 #include "../statistics/core/NumericStatisticalSummary.h" 45 #include "../statistics/core/StringStatisticalSummary.h" 46 #include "../statistics/core/SummaryFunctions.h" 47 #include "../statistics/core/Enums.h" 56 #include <boost/algorithm/string/replace.hpp> 57 #include <boost/lexical_cast.hpp> 61 std::string invalidChar;
67 boost::replace_all(name,
"/",
"_");
68 boost::replace_all(name,
" ",
"_");
69 boost::replace_all(name,
".",
"");
70 boost::replace_all(name,
"'",
"");
71 boost::replace_all(name,
"-",
"_");
72 boost::replace_all(name,
"&",
"e");
91 TE_LOG_DEBUG(
"From SRID: " + std::to_string(fromSrid) +
" | To SRID: " + std::to_string(toSrid));
93 std::unique_ptr<te::da::DataSetType> fromSchemaOrigin =
m_fromLayer->getSchema();
94 std::unique_ptr<te::da::DataSet> fromDsOrigin =
m_fromLayer->getData();
96 std::unique_ptr<te::da::DataSetType> toSchemaOrigin =
m_toLayer->getSchema();
97 std::unique_ptr<te::da::DataSet> toDsOrigin =
m_toLayer->getData();
103 std::unique_ptr<te::da::DataSetType> fromSchema(fromConverter->
getResult());
104 std::unique_ptr<te::da::DataSetAdapter> fromDs(
te::da::CreateAdapter(fromDsOrigin.get(), fromConverter));
110 std::unique_ptr<te::da::DataSetType> toSchema(toConverter->
getResult());
116 if (fromSrid != toSrid)
126 std::unique_ptr<te::mem::DataSet> outDs(
new te::mem::DataSet(outDst.get()));
131 toDs->moveBeforeFirst();
137 std::string logInfo1;
138 std::string logInfo2;
140 std::vector<te::dt::Property*> outProps = outDst->getProperties();
141 std::vector<te::dt::Property*> toProps = toSchema->getProperties();
143 while(toDs->moveNext())
149 for(std::size_t i = 0; i < outProps.size(); ++i)
151 std::string outPropName = outProps[i]->getName();
153 for(std::size_t j = 0; j < toProps.size(); ++j)
155 if(toProps[j]->getName() == outPropName)
157 if(!toDs->isNull(outPropName))
158 item->
setValue(outPropName, toDs->getValue(outPropName).release());
165 bool hasInvalid =
false;
166 std::vector<std::size_t> intersections =
getIntersections(toDs.get(), fromDs.get(), rtree, hasInvalid);
170 #ifdef TERRALIB_LOGGER_ENABLED 174 std::string value =
"Unknown";
176 if (!toDs->isNull(pkProp->
getName()))
177 value = toDs->getValue(pkProp->
getName())->toString();
179 std::string ex =
"The \"To\" layer geometry (" + pkProp->
getName() +
": " + value +
") has intersection candidate invalid!";
181 #endif //TERRALIB_LOGGER_ENABLED 195 std::map<std::string, std::vector<te::attributefill::OperationType> >::iterator it =
m_options.begin();
197 std::vector< std::vector<te::dt::AbstractData*> > dataValues;
203 logInfo1 = it->first;
206 std::size_t propPos = fromSchema->getPropertyPosition(it->first);
211 std::vector<double> numValues;
212 std::vector<std::string> strValues;
226 std::vector<te::attributefill::OperationType> funcs = it->second;
228 for(std::size_t i = 0; i < funcs.size(); ++i)
260 std::map<std::string, double>::iterator itAux = result.begin();
261 while(itAux != result.end())
263 std::string className = itAux->first;
265 std::string newPropName = prop->
getName() +
"_" + className;
267 item->
setDouble(newPropName, itAux->second);
274 if(intersections.size() > 0)
285 double area =
getPercentageOfTotalArea(toDs.get(),
static_cast<size_t>(toSrid), fromDs.get(),
static_cast<size_t>(fromSrid), intersections, prop->
getName(), dataValues);
291 std::map<std::string, double> result =
getPercentageOfEachClassByArea(toDs.get(),
static_cast<size_t>(toSrid), fromDs.get(),
static_cast<size_t>(fromSrid), intersections, prop->
getName(), dataValues);
293 std::map<std::string, double>::iterator itAux = result.begin();
294 while(itAux != result.end())
296 std::string className = itAux->first;
298 std::string newPropName = prop->
getName() +
"_" + className;
300 item->
setDouble(newPropName, itAux->second);
307 double weigh =
getWeightedByArea(toDs.get(),
static_cast<size_t>(toSrid), fromDs.get(),
static_cast<size_t>(fromSrid), intersections, prop->
getName(), dataValues);
313 double weigh =
getWeightedSumByArea(toDs.get(),
static_cast<size_t>(toSrid), fromDs.get(),
static_cast<size_t>(fromSrid), intersections, prop->
getName(), dataValues);
321 if(intersections.empty())
324 kdtree =
getKDtree(fromDs.get(),
static_cast<size_t>(toSrid));
326 result =
getMinimumDistance(toDs.get(),
static_cast<size_t>(toSrid), fromDs.get(),
static_cast<size_t>(fromSrid), kdtree);
336 kdtree =
getKDtree(fromDs.get(),
static_cast<size_t>(toSrid));
346 std::string value =
getValue(ssStr, funcs[i]);
360 double value =
getValue(ssNum, funcs[i]);
375 for (std::size_t a = 0; a < dataValues.size(); ++a)
394 #ifdef TERRALIB_LOGGER_ENABLED 395 std::string ex = e.
what();
396 ex +=
" | Ref: " + logInfo1 +
" : " + logInfo2;
398 #endif //TERRALIB_LOGGER_ENABLED 402 catch(std::exception& e)
404 #ifdef TERRALIB_LOGGER_ENABLED 405 std::string ex = e.what();
406 ex +=
" | Ref: " + logInfo1 +
" : " + logInfo2;
408 #endif //TERRALIB_LOGGER_ENABLED 413 if (!outDs->isEmpty())
415 save(std::move(outDs), std::move(outDst));
430 std::string
id =
m_toLayer->getDataSourceId();
442 std::unique_ptr<te::da::DataSetType> fromSchemaOrigin =
m_fromLayer->getSchema();
443 std::unique_ptr<te::da::DataSet> fromDsOrigin =
m_fromLayer->getData();
445 std::unique_ptr<te::da::DataSetType> toSchemaOrigin =
m_toLayer->getSchema();
446 std::unique_ptr<te::da::DataSet> toDsOrigin =
m_toLayer->getData();
452 std::unique_ptr<te::da::DataSetType> fromSchema(fromConverter->
getResult());
453 std::unique_ptr<te::da::DataSetAdapter> fromDs(
te::da::CreateAdapter(fromDsOrigin.get(), fromConverter));
459 std::unique_ptr<te::da::DataSetType> toSchema(toConverter->
getResult());
466 std::vector<te::dt::Property*> outProps = dst->
getProperties();
470 std::vector<te::dt::Property*> pkProps;
476 for(std::size_t i = 0; i < outProps.size(); ++i)
479 for(std::size_t j = 0; j < pkProps.size(); ++j)
481 if(outProps[i]->getName() == pkProps[j]->getName())
490 std::string name = outProps[i]->getName();
496 std::map<std::string, std::vector<te::attributefill::OperationType> >::iterator it =
m_options.begin();
502 std::vector<te::attributefill::OperationType> funcs = it->second;
504 for(std::size_t i = 0; i < funcs.size(); ++i)
508 std::string newName =
getPropertyName(currentProperty, static_cast<te::attributefill::OperationType>(funcs[i]));
558 for(std::size_t i = 0; i < strClasses.size(); ++i)
560 std::string className = strClasses[i];
564 std::string newPropName = currentProperty->
getName() +
"_" + className;
579 const std::string& propertyName)
581 std::vector<std::string> result;
587 if (fromDs->
isNull(propertyName))
590 std::string strClass = fromDs->
getAsString(propertyName, 9);
592 if(std::find(result.begin(), result.end(), strClass) == result.end())
594 result.push_back(strClass);
616 if (data->
isNull(geomPos))
619 std::unique_ptr<te::gm::Geometry> geom = data->
getGeometry(geomPos);
621 rtree->
insert(*geom->getMBR(),
static_cast<unsigned long>(count));
623 m_mapGeom.insert(std::map<int, te::gm::Geometry*>::value_type(count, geom.release()));
635 std::string newName = name +
"_";
640 newName +=
"min_val";
642 newName +=
"max_val";
646 newName +=
"sum_values";
648 newName +=
"total_values";
650 newName +=
"total_notnull_values";
652 newName +=
"total_distinct";
654 newName +=
"stand_dev";
656 newName +=
"variance";
658 newName +=
"skewness";
660 newName +=
"kurtosis";
662 newName +=
"amplitude";
666 newName +=
"coeff_variation";
670 newName +=
"class_high_occurrence";
672 newName +=
"class_high_area";
674 newName +=
"min_distance";
676 newName +=
"dis_cent";
678 newName +=
"presence";
680 newName +=
"percent_of_total_area";
682 newName +=
"percent_area_class";
684 newName +=
"weigh_area";
686 newName +=
"weigh_sum_area";
688 newName +=
"percent_class";
700 std::unique_ptr<te::gm::Geometry> geom = toDs->
getGeometry(toSpatialPos);
702 std::vector<size_t> report;
703 rtree->
search(*geom->getMBR(), report);
705 std::vector<std::size_t> interVec;
706 for(std::size_t i = 0; i < report.size(); ++i)
715 if(geom->intersects(g) && !geom->touches(g))
717 interVec.push_back(report[i]);
725 std::vector<double> result;
727 for (std::size_t t = 0; t < dataValues.size(); ++t)
729 std::vector<te::dt::AbstractData*> data = dataValues[t];
733 result.push_back(
double(0.0f));
750 std::string strValue = data[pos]->toString();
752 result.push_back(boost::lexical_cast<double>(strValue));
761 std::vector<std::string> result;
763 for (std::size_t t = 0; t < dataValues.size(); ++t)
765 std::vector<te::dt::AbstractData*> data = dataValues[t];
769 result.push_back(
"");
774 result.push_back(data[pos]->toString());
782 const std::string& propertyName,
783 std::vector< std::vector<te::dt::AbstractData*> >& dataValues)
785 std::set<std::string> aux;
787 for (
auto v : dataValues)
792 aux.insert(v[propIndex]->toString());
795 return (
int)aux.size();
862 return boost::lexical_cast<std::string>(ss.
m_count);
864 return boost::lexical_cast<std::string>(ss.
m_validCount);
872 std::vector<double> values = ss.
m_mode;
873 for(std::size_t i = 0; i < values.size(); ++i)
876 result += boost::lexical_cast<std::string>(values[i]);
878 result +=
", " + boost::lexical_cast<std::string>(values[i]);
885 std::vector<std::size_t> dsPos)
887 std::vector<std::vector<te::dt::AbstractData*> > result;
889 for(std::size_t i = 0; i < dsPos.size(); ++i)
891 std::vector<te::dt::AbstractData*> resultItem;
893 fromDs->
move(dsPos[i]);
898 resultItem.push_back(
nullptr);
900 resultItem.push_back(fromDs->
getValue(t).release());
902 result.push_back(resultItem);
909 std::vector<std::size_t> dsPos,
910 const std::string& propertyName,
911 std::vector< std::vector<te::dt::AbstractData*> >& dataValues)
916 std::size_t highOccur = 0;
917 std::vector<std::string> highValues;
919 std::map<std::string, std::size_t> counter;
920 for (std::size_t i = 0; i < dsPos.size(); ++i)
922 if (!dataValues[i][static_cast<size_t>(propIndex)])
925 std::string value = dataValues[i][
static_cast<size_t>(propIndex)]->toString();
927 if (counter.find(value) == counter.end())
936 std::size_t aux = counter[value] + 1;
937 counter[value] = aux;
944 std::map<std::string, std::size_t>::iterator it = counter.begin();
945 while (it != counter.end())
947 if (it->second == highOccur)
948 highValues.push_back(it->first);
952 if (highValues.size() > 1)
954 std::vector<double> intVec;
965 for (std::size_t i = 0; i < highValues.size(); ++i)
967 intVec.push_back(boost::lexical_cast<double>(highValues[i]));
973 std::string strVal = boost::lexical_cast<std::string>(ssNum.
m_minVal);
977 else if (!highValues.empty())
987 std::vector<std::size_t> dsPos,
988 const std::string& propertyName,
989 std::vector< std::vector<te::dt::AbstractData*> >& dataValues)
996 std::unique_ptr<te::gm::Geometry> toGeom = toDs->
getGeometry(toGeomPos);
997 if(toGeom->getSRID() <= 0)
998 toGeom->setSRID(static_cast<int>(toSrid));
1000 std::map<std::string, double> classAreaMap;
1001 for(std::size_t i = 0; i < dsPos.size(); ++i)
1003 if (!dataValues[i][static_cast<size_t>(propIndex)])
1008 std::unique_ptr<te::gm::Geometry> interGeom;
1018 interGeom.reset(toGeom->intersection(fromGeom));
1020 catch(
const std::exception &e)
1022 #ifdef TERRALIB_LOGGER_ENABLED 1023 std::string ex = e.what();
1025 #endif //TERRALIB_LOGGER_ENABLED 1030 std::string value = dataValues[i][
static_cast<size_t>(propIndex)]->toString();
1032 double area =
getArea(interGeom.get());
1034 if(classAreaMap.find(value) == classAreaMap.end())
1036 classAreaMap[value] = area;
1040 double aux = classAreaMap[value];
1041 classAreaMap[value] = aux + area;
1045 std::map<std::string, double>::iterator it = classAreaMap.begin();
1048 while(it != classAreaMap.end())
1050 if(aux < it->second)
1065 std::vector<std::size_t> dsPos,
1066 const std::string& propertyName,
1067 std::vector< std::vector<te::dt::AbstractData*> >& dataValues)
1071 std::map<std::string, double> result;
1073 std::map<std::string, std::size_t> aux;
1074 for(std::size_t i = 0; i < dsPos.size(); ++i)
1076 if (dataValues[i][static_cast<size_t>(propIndex)] ==
nullptr)
1079 std::string value = dataValues[i][
static_cast<size_t>(propIndex)]->toString();
1081 if(aux.find(value) == aux.end())
1091 std::size_t total = 0;
1092 std::map<std::string, std::size_t>::iterator it = aux.begin();
1093 while(it != aux.end())
1095 total += it->second;
1101 while(it != aux.end())
1103 std::string normName = it->first;
1105 result[normName] = (
static_cast<double>(it->second / total));
1117 std::vector<std::size_t> dsPos,
1119 std::vector< std::vector<te::dt::AbstractData*> >&)
1123 std::unique_ptr<te::gm::Geometry> toGeom = toDs->
getGeometry(toGeomPos);
1124 if(toGeom->getSRID() <= 0)
1125 toGeom->setSRID(static_cast<int>(toSrid));
1127 double classArea = 0;
1128 for(std::size_t i = 0; i < dsPos.size(); ++i)
1140 std::unique_ptr<te::gm::Geometry> interGeom(toGeom->intersection(fromGeom));
1142 classArea +=
getArea(interGeom.get());
1145 double polArea =
getArea(toGeom.get());
1147 return classArea/polArea;
1154 std::vector<std::size_t> dsPos,
1155 const std::string& propertyName,
1156 std::vector< std::vector<te::dt::AbstractData*> >& dataValues)
1158 std::map<std::string, double> result;
1164 std::unique_ptr<te::gm::Geometry> toGeom = toDs->
getGeometry(toGeomPos);
1165 if(toGeom->getSRID() <= 0)
1166 toGeom->setSRID(static_cast<int>(toSrid));
1168 double toGeomArea =
getArea(toGeom.get());
1170 for(std::size_t i = 0; i < dsPos.size(); ++i)
1172 if (dataValues[i][static_cast<size_t>(propIndex)] ==
nullptr)
1183 std::unique_ptr<te::gm::Geometry> interGeom(toGeom->intersection(fromGeom));
1185 std::string value = dataValues[i][
static_cast<size_t>(propIndex)]->toString();
1187 double area =
getArea(interGeom.get());
1189 if(result.find(value) == result.end())
1191 result[value] = area/toGeomArea;
1195 result[value] += area/toGeomArea;
1206 std::vector<std::size_t> dsPos,
1207 const std::string& propertyName,
1208 std::vector< std::vector<te::dt::AbstractData*> >& dataValues)
1214 std::unique_ptr<te::gm::Geometry> toGeom = toDs->
getGeometry(toGeomPos);
1215 if(toGeom->getSRID() <= 0)
1216 toGeom->setSRID(static_cast<int>(toSrid));
1218 double toGeomArea =
getArea(toGeom.get());
1222 for(std::size_t i = 0; i < dsPos.size(); ++i)
1224 if (dataValues[i][static_cast<size_t>(propIndex)] ==
nullptr)
1235 std::unique_ptr<te::gm::Geometry> interGeom(toGeom->intersection(fromGeom));
1237 double value_num = 0;
1239 std::string value = dataValues[i][
static_cast<size_t>(propIndex)]->toString();
1240 value_num = boost::lexical_cast<
double>(value);
1242 double intersectionArea =
getArea(interGeom.get());
1244 weigh += value_num*(intersectionArea/toGeomArea);
1254 std::vector<std::size_t> dsPos,
1255 const std::string& propertyName,
1256 std::vector< std::vector<te::dt::AbstractData*> >& dataValues)
1262 std::unique_ptr<te::gm::Geometry> toGeom = toDs->
getGeometry(toGeomPos);
1263 if(toGeom->getSRID() <= 0)
1264 toGeom->setSRID(static_cast<int>(toSrid));
1268 for(std::size_t i = 0; i < dsPos.size(); ++i)
1270 if (dataValues[i][static_cast<size_t>(propIndex)] ==
nullptr)
1275 double fromGeomArea =
getArea(fromGeom);
1283 std::unique_ptr<te::gm::Geometry> interGeom(toGeom->intersection(fromGeom));
1285 double value_num = 0;
1287 std::string value = dataValues[i][
static_cast<size_t>(propIndex)]->toString();
1288 value_num = boost::lexical_cast<
double>(value);
1290 double intersectionArea =
getArea(interGeom.get());
1292 weigh += value_num*(intersectionArea/fromGeomArea);
1456 int16_t v = boost::lexical_cast<int16_t>(strValue);
1462 int32_t v = boost::lexical_cast<int32_t>(strValue);
1468 int64_t v = boost::lexical_cast<int64_t>(strValue);
1474 uint16_t v = boost::lexical_cast<uint16_t>(strValue);
1480 uint32_t v = boost::lexical_cast<uint32_t>(strValue);
1486 uint64_t v = boost::lexical_cast<uint64_t>(strValue);
1505 std::vector<std::pair<te::gm::Coord2D, te::gm::Point> > kdset;
1511 std::unique_ptr<te::gm::Geometry> geom = data->
getGeometry(geomPos);
1515 for(std::size_t i = 0; i < allPoints.size(); ++i)
1519 if(p->
getSRID() !=
static_cast<int>(toSrid))
1526 kdset.push_back(std::pair<te::gm::Coord2D, te::gm::Point>(coord, point));
1532 kdtree->
build(kdset);
1544 std::unique_ptr<te::gm::Geometry> toGeom = toDs->
getGeometry(toGeomPos);
1548 std::vector<double> distances;
1550 for (std::size_t i = 0; i < allPoints.size(); ++i)
1554 std::vector<te::gm::Point> points;
1555 points.push_back(
te::gm::Point(std::numeric_limits<double>::max(), std::numeric_limits<double>::max()));
1556 std::vector<double> sqrDists;
1560 distances.push_back(sqrDists[0]);
1565 double finalResult = std::numeric_limits<double>::max();
1566 for (std::size_t i = 0; i < distances.size(); ++i)
1568 if (distances[i] < finalResult)
1569 finalResult = distances[i];
1572 return sqrt(finalResult);
1578 std::size_t fromSrid,
1583 std::unique_ptr<te::gm::Geometry> toGeom = toDs->
getGeometry(toGeomPos);
1587 aux.
setSRID(static_cast<int>(toSrid));
1590 std::vector<size_t> report;
1593 for (std::size_t i : report)
1604 std::vector<te::gm::Point> points;
1605 points.push_back(
te::gm::Point(std::numeric_limits<double>::max(), std::numeric_limits<double>::max()));
1606 std::vector<double> sqrDists;
1610 if (fromSrid != static_cast<size_t>(aux.
getSRID()))
1611 aux.
transform(static_cast<int>(fromSrid));
1614 double distance = points[0].distance(&aux);
1623 std::vector<te::gm::Point*> result;
1647 result.insert(result.end(), vec.begin(), vec.end());
1665 for(std::size_t j = 0; j < lr->
getNPoints(); ++j)
1667 result.push_back(lr->
getPointN(j).release());
1685 result.insert(result.end(), vec.begin(), vec.end());
1696 for(std::size_t i = 0; i < g->
getNPoints(); ++i)
1698 result.push_back(g->
getPointN(i).release());
1715 result.insert(result.end(), vec.begin(), vec.end());
1722 return std::vector<te::gm::Point*>();
1731 std::map<std::string, std::vector<te::attributefill::OperationType> >::iterator it =
m_options.begin();
1735 std::vector<te::attributefill::OperationType> ops = it->second;
1737 for(std::size_t i = 0; i < ops.size(); ++i)
1754 #ifdef TERRALIB_LOGGER_ENABLED 1755 std::string ex =
TE_TR(
"\"From\" layer geometry at position ");
1756 ex += boost::lexical_cast<std::string>(fromPos);
1757 ex +=
TE_TR(
" is invalid.");
1759 #endif //TERRALIB_LOGGER_ENABLED 1765 #ifdef TERRALIB_LOGGER_ENABLED 1766 std::string ex =
TE_TR(
"\"To\" layer geometry is invalid.");
1768 #endif //TERRALIB_LOGGER_ENABLED void normalizeClassName(std::string &name)
VectorToVectorMemory()
Constructor.
std::vector< te::gm::Point * > getAllPointsOfGeometry(te::gm::Geometry *geom)
It get all points of a geometry.
virtual std::unique_ptr< te::gm::Geometry > getGeometry(std::size_t i) const =0
Method for retrieving a geometric attribute value.
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.
void setAutoNumber(bool a)
It tells if the property is an autonumber or not.
std::size_t getNumGeometries() const
It returns the number of geometries in this GeometryCollection.
void setTitle(const std::string &title)
It sets a human descriptive title for the DataSetType.
bool save(std::unique_ptr< te::mem::DataSet > result, std::unique_ptr< te::da::DataSetType > outDsType)
std::vector< std::string > m_toLayerProps
bool isStatistical(te::attributefill::OperationType type)
It verify if the operation is a statistical operation.
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.
void setDouble(std::size_t i, double value)
It sets the value of the i-th property.
void setSRID(int srid) _NOEXCEPT_OP(true)
It sets the Spatial Reference System ID of the Point.
bool intersects(const Envelope &rhs) const
It returns true if the envelopes "spatially intersects".
An atomic property like an integer or double.
te::map::AbstractLayerPtr m_toLayer
std::vector< double > getNumValues(std::vector< std::vector< te::dt::AbstractData * > > dataValues, std::size_t pos)
It get the numeric values of a vector of abstract data.
std::string Convert2LCase(const std::string &value)
It converts a string to lower case.
TEDATAACCESSEXPORT void AssociateDataSetTypeConverterSRID(DataSetTypeConverter *converter, const int &inputSRID, const int &outputSRID=TE_UNKNOWN_SRS)
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.
GeomType getGeomTypeId() const _NOEXCEPT_OP(true)
It returns the geometry subclass type identifier.
std::map< std::string, std::vector< te::attributefill::OperationType > > m_options
te::dt::AbstractData * getDataBasedOnType(const std::string &strValue, const int type)
It get a abstract data with the value based on the type.
DataSetType * getResult() const
A class that represents a two dimensional K-d Tree (2-d Tree) that store data-elements into the leafs...
This class can be used to inform the progress of a task.
std::vector< std::size_t > getIntersections(te::da::DataSet *toDs, te::da::DataSet *fromDs, te::sam::rtree::Index< size_t, 8 > *rtree, bool &hasInvalid)
It verify all intersection between the "From" and "To" data sets.
void setValue(std::size_t i, te::dt::AbstractData *value)
It sets the value of the i-th property.
std::vector< double > m_mode
std::unique_ptr< Point > getPointN(std::size_t i) const
It returns the specified point in this LineString.
PrimaryKey * getPrimaryKey() const
It returns the primary key associated to the dataset 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, std::vector< std::vector< te::dt::AbstractData * > > &dataValues)
It get the percentage of each class intersection area in the total area.
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.
virtual bool intersects(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns true if the geometry object spatially intersects rhs geometry.
virtual Property * clone() const =0
It returns a clone of the object.
#define TE_LOG_INFO(message)
Use this tag in order to log a message to the TerraLib default logger with the INFO level...
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.
const std::vector< te::dt::Property * > & getProperties() const
It returns the properties that take part of the primary key.
void setDefaultValue(std::string *d)
It sets the default value associated to the property, or NULL if none is associated.
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.
An converter for DataSetType.
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.
te::da::DataSourcePtr m_outDsrc
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.
int getSRID() const _NOEXCEPT_OP(true)
It returns the Spatial Reference System ID associated to this geometric object.
void setName(const std::string &name)
It sets the property name.
MultiPoint is a GeometryCollection whose elements are restricted to points.
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, std::vector< std::vector< te::dt::AbstractData * > > &dataValues)
It get the percentage of intersection area in the total area.
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.
static DataSourceInfoManager & getInstance()
It returns a reference to the singleton instance.
A point with x and y coordinate values.
const Envelope * getMBR() const _NOEXCEPT_OP(true)
It returns the minimum bounding rectangle for the geometry in an internal representation.
virtual int getPropertyDataType(std::size_t i) const =0
It returns the underlying data type of the property at position pos.
virtual bool isValid() const _NOEXCEPT_OP(false)
It tells if the geometry is well formed.
An Envelope defines a 2D rectangular region.
void build(std::vector< std::pair< kdKey, kdDataItem > > &dataSet)
It inserts the data set into the tree.
te::sam::kdtree::AdaptativeIndex< KD_ADAPTATIVE_NODE > KD_ADAPTATIVE_TREE
void transform(int srid) _NOEXCEPT_OP(false)
It converts the coordinate values of the point to the new spatial reference system.
bool hasNoIntersectionOperations()
Verify if has operations that don't need the intersections.
TESTATEXPORT void GetNumericStatisticalSummary(std::vector< double > &values, te::stat::NumericStatisticalSummary &ss, double nullValue)
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.
virtual bool contains(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns true if this geometry object spatially contains rhs geometry.
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.
te::dt::AbstractData * getClassWithHighestOccurrence(te::da::DataSet *fromDs, std::vector< std::size_t > dsPos, const std::string &propertyName, std::vector< std::vector< te::dt::AbstractData * > > &dataValues)
It get the class with highest occurrence from "From" data set in "To" data set.
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, std::vector< std::vector< te::dt::AbstractData * > > &dataValues)
It get the sum of weighted average if intersections values.
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.
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, std::vector< std::vector< te::dt::AbstractData * > > &dataValues)
It get the class with highest intersection area from "From" data set in "To" data set...
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.
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.
Configuration flags for the Attribute Fill module of TerraLib.
double getArea() const
It returns the area of this surface, as measured in the spatial reference system of this surface...
int getTotalNumberOfDistinctValues(te::da::DataSet *fromDs, const std::string &propertyName, std::vector< std::vector< te::dt::AbstractData * > > &dataValues)
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.
TESTATEXPORT void GetStringStatisticalSummary(std::vector< std::string > &values, te::stat::StringStatisticalSummary &ss, const std::string &nullValue)
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.
MultiSurface is a class that represents a 2-dimensional GeometryCollection whose elements are surface...
virtual std::unique_ptr< te::dt::AbstractData > getValue(std::size_t i) const
Method for retrieving any other type of data value stored in the data source.
A structure to hold the set of statistics from a set of categorical (sample) values.
It describes a primary key (pk) constraint.
std::vector< std::vector< te::dt::AbstractData * > > getDataValues(te::da::DataSet *fromDs, std::vector< std::size_t > dsPos)
It get the value of all positions in "To" data set that has intersection with a position of "From" da...
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.
#define TE_LOG_DEBUG(message)
Use this tag in order to log a message to the TerraLib default logger with the DEBUG level...
std::map< std::size_t, te::gm::Geometry * > m_mapGeom
virtual bool isNull(std::size_t i) const =0
It checks if the attribute value is NULL.
te::da::DataSetType * getOutputDataSetType()
It create a data set type based on selecteds properties and operations.
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.
double getMinimumDistanceFromCentroid(te::da::DataSet *toDs, std::size_t toSrid, te::da::DataSet *fromDs, std::size_t fromSrid, KD_ADAPTATIVE_TREE *kdtree, te::sam::rtree::Index< size_t, 8 > *rtree)
It get the minimum distance of objects centroid that not intersect.
virtual std::size_t getNumProperties() const =0
It returns the number of properties that composes an item of the dataset.
It is a collection of other geometric objects.
te::map::AbstractLayerPtr m_fromLayer
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.
TEDATAACCESSEXPORT DataSetAdapter * CreateAdapter(DataSet *ds, DataSetTypeConverter *converter, bool isOwner=false)
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...
virtual std::unique_ptr< te::gm::Envelope > getExtent(std::size_t i)=0
It computes the bounding rectangle for a spatial property of the dataset.
double getArea(te::gm::Geometry *geom)
It get the area of a geometry.
OperationType
Define grouping operations type.
void transform(int oldsrid, int newsrid)
It will transform the coordinates of the Envelope from the old SRS to the new one.
void FreeContents(boost::unordered_map< K, V * > &m)
This function can be applied to a map of pointers. It will delete each pointer in the map...
std::vector< std::string > getStrValues(std::vector< std::vector< te::dt::AbstractData * > > dataValues, std::size_t pos)
It get the string values of a vector of abstract data.
const double & getX() const
It returns the Point x-coordinate value.
std::map< std::string, double > getPercentagePerClass(te::da::DataSet *fromDs, std::vector< std::size_t > dsPos, const std::string &propertyName, std::vector< std::vector< te::dt::AbstractData * > > &dataValues)
It get the percent per class from "From" data set in "To" data set.
TESTATEXPORT void Mode(const std::vector< double > &values, te::stat::NumericStatisticalSummary &ss)
bool isMultiPolygon(te::gm::GeomType type)
It verify if the geometry is a multi polygon.
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, std::vector< std::vector< te::dt::AbstractData * > > &dataValues)
It get the weighted average if intersections values.
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.