diff --git a/hoot-core/src/main/cpp/hoot/core/conflate/polygon/BuildingMerger.cpp b/hoot-core/src/main/cpp/hoot/core/conflate/polygon/BuildingMerger.cpp
index 75963d6..02addcf 100644
--- a/hoot-core/src/main/cpp/hoot/core/conflate/polygon/BuildingMerger.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/conflate/polygon/BuildingMerger.cpp
@@ -22,7 +22,7 @@
* This will properly maintain the copyright information. DigitalGlobe
* copyrights will be updated automatically.
*
- * @copyright Copyright (C) 2015, 2016, 2017, 2018, 2019 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2015, 2016, 2017, 2018, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
*/
#include "BuildingMerger.h"
@@ -53,6 +53,7 @@
#include <hoot/core/visitors/UniqueElementIdVisitor.h>
#include <hoot/core/visitors/WorstCircularErrorVisitor.h>
#include <hoot/core/algorithms/extractors/IntersectionOverUnionExtractor.h>
+#include <hoot/core/conflate/polygon/BuildingMatch.h>
using namespace std;
@@ -228,6 +229,11 @@ void BuildingMerger::apply(const OsmMapPtr& map, vector<pair<ElementId, ElementI
keeper->setTags(_getMergedTags(e1, e2));
keeper->setStatus(Status::Conflated);
+ ConfigOptions conf;
+ if (conf.getWriterIncludeDebugTags() && conf.getWriterIncludeMatchedByTag())
+ {
+ keeper->setTag(MetadataTags::HootMatchedBy(), BuildingMatch::MATCH_NAME);
+ }
LOG_TRACE("BuildingMerger: keeper\n" << OsmUtils::getElementDetailString(keeper, map));
LOG_TRACE("BuildingMerger: scrap\n" << OsmUtils::getElementDetailString(scrap, map));
@@ -562,6 +568,7 @@ RelationPtr BuildingMerger::combineConstituentBuildingsIntoRelation(
{
throw IllegalArgumentException("No constituent buildings passed to building merger.");
}
+ LOG_TRACE("Combining constituent buildings into a relation...");
// This is primarily put here to support testable output.
InMemoryElementSorter::sort(constituentBuildings);
@@ -575,14 +582,27 @@ RelationPtr BuildingMerger::combineConstituentBuildingsIntoRelation(
threeDBuildingKeys.append(MetadataTags::BuildingHeight());
const bool allAreBuildingParts =
OsmUtils::allElementsHaveAnyTagKey(threeDBuildingKeys, constituentBuildings);
- // skipping a building relation and doing a multipoly if only some of the buildings have height
- // tags; this behavior is debatable
+ LOG_VART(allAreBuildingParts);
+ // Here, we're skipping a building relation and doing a multipoly if only some of the buildings
+ // have height tags. This behavior is debatable...
if (!allAreBuildingParts &&
OsmUtils::anyElementsHaveAnyTagKey(threeDBuildingKeys, constituentBuildings))
{
- LOG_WARN(
- "Merging building group where some buildings have 3D tags and others do not. A " <<
- "multipolygon relation will be created instead of a building relation.")
+ if (logWarnCount < Log::getWarnMessageLimit())
+ {
+ // used to actually log a warning for this but seem excessive...still going to limit it like
+ // a warning, though.
+ LOG_DEBUG(
+ "Merging building group where some buildings have 3D tags and others do not. A " <<
+ "multipolygon relation will be created instead of a building relation. Buildings: " <<
+ OsmUtils::elementsToElementIds(constituentBuildings));
+ }
+ else if (logWarnCount == Log::getWarnMessageLimit())
+ {
+ LOG_WARN(className() << ": " << Log::LOG_WARN_LIMIT_REACHED_MESSAGE);
+ }
+ logWarnCount++;
+ LOG_VART(OsmUtils::getElementsDetailString(constituentBuildings, map));
}
// put the building parts into a relation
@@ -595,9 +615,10 @@ RelationPtr BuildingMerger::combineConstituentBuildingsIntoRelation(
new Relation(
constituentBuildings[0]->getStatus(), map->createNextRelationId(),
WorstCircularErrorVisitor::getWorstCircularError(constituentBuildings), relationType));
+ LOG_VART(parentRelation->getElementId());
TagMergerPtr tagMerger;
- LOG_VARD(preserveTypes);
+ LOG_VART(preserveTypes);
std::set<QString> overwriteExcludeTags;
if (allAreBuildingParts)
{
@@ -605,6 +626,7 @@ RelationPtr BuildingMerger::combineConstituentBuildingsIntoRelation(
// skipped
overwriteExcludeTags = BuildingRelationMemberTagMerger::getBuildingPartTagNames();
}
+ LOG_VART(overwriteExcludeTags);
if (!preserveTypes)
{
tagMerger.reset(new BuildingRelationMemberTagMerger(overwriteExcludeTags));
@@ -659,6 +681,7 @@ RelationPtr BuildingMerger::combineConstituentBuildingsIntoRelation(
// allAreBuildingParts = building relation
!allAreBuildingParts &&
ConfigOptions().getAttributeConflationSuppressBuildingTagOnMultipolyRelationConstituents();
+ LOG_VART(suppressBuildingTagOnConstituents);
for (Tags::const_iterator it = relationTags.begin(); it != relationTags.end(); ++it)
{
// Remove any tags in the parent relation from each of the constituent buildings.