@Override public Optional<String> getTag(final String tagName) { return getSource().getTag(tagName); }
public static boolean isLake(final AtlasEntity entity) { /* * If area (1) natural == water (2) natural == water && water == "lake" */ if (Validators.isOfType(entity, NaturalTag.class, NaturalTag.WATER)) { if (Validators.isOfType(entity, WaterTag.class, WaterTag.LAKE, WaterTag.OXBOW)) { return true; } // We have some rivers where no water tag is specified, but waterway is present if (entity.getTag(WaterwayTag.KEY).isPresent() || entity.getTag(LandUseTag.KEY).isPresent()) { return false; } // Other water bodies, such as harbors, may have natural=water, but no water tag. We // want to exclude these to avoid creating duplicate water bodies. if (HarbourHandler.isHarbour(entity)) { return false; } // According to OSM : A water body is by default a lake, when no water tag is specified return !entity.getTag(WaterTag.KEY).isPresent(); } return false; }
@Test public void testLoadNoEdgesByTag() { final DynamicAtlas dynamicAtlas = new DynamicAtlas(this.policySupplier.get() .withAtlasEntitiesToConsiderForExpansion( entity -> "relation".equals(entity.getTag("type").orElse(""))) .withAggressivelyExploreRelations(true)); runLoadNoEdgesTest(dynamicAtlas); }
final Optional<String> countryCodeString = entity.getTag(ISOCountryTag.KEY); if (countryCodeString.isPresent())
@Test public void testFilteredOutSubRelation() { final Atlas source = this.rule.getFilteredOutMemberRelationAtlas(); final Predicate<AtlasEntity> filteredOutPredicate = entity -> !"excluded" .equals(entity.getTag("type").orElse("")); final Atlas filteredOutSubRelationAtlas = source .subAtlas(filteredOutPredicate, AtlasCutType.SOFT_CUT) .orElseThrow(() -> new CoreException("SubAtlas was not present.")); Assert.assertNull(filteredOutSubRelationAtlas.node(5)); Assert.assertNotNull(filteredOutSubRelationAtlas.node(3)); Assert.assertNotNull(filteredOutSubRelationAtlas.node(4)); Assert.assertNotNull(filteredOutSubRelationAtlas.relation(8)); }