-
Notifications
You must be signed in to change notification settings - Fork 74
v0.2.53..v0.2.54 changeset Polygon.js
Garret Voltz edited this page Mar 31, 2020
·
1 revision
diff --git a/rules/Polygon.js b/rules/Polygon.js
index f1ff8f1..9a5743a 100644
--- a/rules/Polygon.js
+++ b/rules/Polygon.js
@@ -18,7 +18,7 @@ exports.experimental = false;
exports.baseFeatureType = "Polygon";
exports.writeMatchedBy = hoot.get("writer.include.matched.by.tag");
exports.geometryType = "polygon";
-exports.matchCandidateCriterion = "hoot::PolygonCriterion"; // See #3047
+exports.matchCandidateCriterion = "hoot::PolygonCriterion";
var overlapExtractor =
new hoot.SmallerOverlapExtractor({ "convert.require.area.for.polygon": "false" });
@@ -33,7 +33,13 @@ var overlapExtractor =
*/
exports.isMatchCandidate = function(map, e)
{
- return isPolygon(e) && !isSpecificallyConflatable(map, e);
+ // If the poly is generic but part of a building relation we want Building Conflation to handle
+ // it instead.
+ if (isMemberOfRelationInCategory(map, e.getElementId(), "building"))
+ {
+ return false;
+ }
+ return isPolygon(e) && !isSpecificallyConflatable(map, e, exports.geometryType);
};
/**
@@ -78,14 +84,16 @@ exports.matchScore = function(map, e1, e2)
hoot.trace("e2 note: " + e2.getTags().get("note"));
}
- var typeScore = getTypeScore(map, e1, e2);
- var typeScorePassesThreshold = false;
- if (typeScore >= exports.tagThreshold)
+ // TODO: Should we do anything with names?
+
+ // If both features have types and they aren't just generic types, let's do a detailed type comparison and
+ // look for an explicit type mismatch. Otherwise, move on to the geometry comparison.
+ var typeScorePassesThreshold = !explicitTypeMismatch(e1, e2, exports.tagThreshold);
+ hoot.trace("typeScorePassesThreshold: " + typeScorePassesThreshold);
+ if (!typeScorePassesThreshold)
{
- typeScorePassesThreshold = true;
+ return result;
}
- hoot.trace("typeScore: " + typeScore);
- hoot.trace("typeScorePassesThreshold: " + typeScorePassesThreshold);
// These geometry rules were derived by using training data in Weka with the
// REPTree model w/ maxDepth set to 3. Note: This was taken directly from Building.js.