Skip to content

v0.2.52..v0.2.53 changeset PoiPolygonPolyCriterion.cpp

Garret Voltz edited this page Feb 12, 2020 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/criterion/poi-polygon/PoiPolygonPolyCriterion.cpp b/hoot-core/src/main/cpp/hoot/core/criterion/poi-polygon/PoiPolygonPolyCriterion.cpp
index 118c5a9..0cd436d 100644
--- a/hoot-core/src/main/cpp/hoot/core/criterion/poi-polygon/PoiPolygonPolyCriterion.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/criterion/poi-polygon/PoiPolygonPolyCriterion.cpp
@@ -22,7 +22,7 @@
  * This will properly maintain the copyright information. DigitalGlobe
  * copyrights will be updated automatically.
  *
- * @copyright Copyright (C) 2015, 2017, 2018, 2019 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2015, 2017, 2018, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
  */
 #include "PoiPolygonPolyCriterion.h"
 
@@ -49,13 +49,23 @@ _tagIgnoreList(PoiPolygonTagIgnoreListReader::getInstance().getPolyTagIgnoreList
 
 bool PoiPolygonPolyCriterion::isSatisfied(const ConstElementPtr& e) const
 {
+  LOG_VART(e->getElementId());
+
+  if (e->getElementType() == ElementType::Node)
+  {
+    return false;
+  }
+
   const Tags& tags = e->getTags();
 
-  //Using this looser definition b/c isLinearHighway will return false if any tag is in an area
-  //category and not a linestring category, which still gives us some features we don't want to
-  //conflate with poi/poly.
-  if (tags.contains("highway"))
+  // Using this looser definition b/c isLinearHighway will return false if any tag is in an area
+  // category and not a linestring category, which still gives us some features we don't want to
+  // conflate with poi/poly. Do an empty string check here, b/c oddly at some point in the
+  // conflation chain empty highway tags get added (among others) to features and then are removed
+  // at a later point...probably something that needs to be looked into.
+  if (!tags.get("highway").trimmed().isEmpty())
   {
+    LOG_TRACE("tags contain highway");
     return false;
   }
 
@@ -66,18 +76,19 @@ bool PoiPolygonPolyCriterion::isSatisfied(const ConstElementPtr& e) const
     LOG_TRACE("Contains tag from tag ignore list");
     return false;
   }
-  LOG_TRACE("Does not contain tag from tag ignore list");
 
-  // TODO: should use be added as a category here?
+  // TODO: should "use" be added as a category here?
   const bool inABuildingOrPoiCategory =
     OsmSchema::getInstance().getCategories(tags)
       .intersects(OsmSchemaCategory::building() | OsmSchemaCategory::poi());
+  LOG_VART(inABuildingOrPoiCategory);
+  LOG_VART(tags.getNames().size());
+  LOG_VART(AreaCriterion().isSatisfied(e));
   //isArea includes building too
   const bool isPoly =
     AreaCriterion().isSatisfied(e) && (inABuildingOrPoiCategory || tags.getNames().size() > 0);
 
-  //LOG_VART(e);
-  //LOG_VART(isPoly);
+  LOG_VART(isPoly);
   return isPoly;
 }
 
Clone this wiki locally