diff --git a/src/main/scala/edu/ie3/osmogrid/model/OsmoGridModel.scala b/src/main/scala/edu/ie3/osmogrid/model/OsmoGridModel.scala index c17d6442..5c624659 100644 --- a/src/main/scala/edu/ie3/osmogrid/model/OsmoGridModel.scala +++ b/src/main/scala/edu/ie3/osmogrid/model/OsmoGridModel.scala @@ -6,6 +6,7 @@ package edu.ie3.osmogrid.model +import com.typesafe.scalalogging.LazyLogging import edu.ie3.osmogrid.model.SourceFilter.{Filter, LvFilter} import edu.ie3.util.osm.model.OsmContainer.ParOsmContainer import edu.ie3.util.osm.model.OsmEntity.Relation.RelationMemberType @@ -23,7 +24,7 @@ sealed trait OsmoGridModel { def +(additional: OsmoGridModel): Option[OsmoGridModel] } -object OsmoGridModel { +object OsmoGridModel extends LazyLogging { def filterForSubstations( entities: ParSeq[EnhancedOsmEntity] @@ -126,7 +127,9 @@ object OsmoGridModel { entities.filter { case entity: E if entity.metaInformation.isDefined => entity.metaInformation.exists(_.version.contains(maxVersion)) - case _ => true + case entity: E if !entity.metaInformation.isDefined => + logger.info(s"Warning: ${entity.id} does not contain any meta information to identify the version id of the OsmEntity, so it was filtered out.") + false } } .toSeq diff --git a/src/test/scala/edu/ie3/osmogrid/model/OsmTestData.scala b/src/test/scala/edu/ie3/osmogrid/model/OsmTestData.scala index 5b992872..439c8f33 100644 --- a/src/test/scala/edu/ie3/osmogrid/model/OsmTestData.scala +++ b/src/test/scala/edu/ie3/osmogrid/model/OsmTestData.scala @@ -152,7 +152,7 @@ trait OsmTestData { nodes.building1Node1.id ), Map("building" -> "yes"), - None + Some(OsmEntity.MetaInformation(Some(0), None, None, None, None, None)) ) val building2: ClosedWay = @@ -166,7 +166,7 @@ trait OsmTestData { nodes.building2Node1.id ), Map("building" -> "yes"), - None + Some(OsmEntity.MetaInformation(Some(0), None, None, None, None, None)) ) val building3: ClosedWay = @@ -180,7 +180,7 @@ trait OsmTestData { nodes.building3Node1.id ), Map("building" -> "yes"), - None + Some(OsmEntity.MetaInformation(Some(0), None, None, None, None, None)) ) val highway1: OpenWay = @@ -188,7 +188,7 @@ trait OsmTestData { 111L, Seq(nodes.highway1Node1.id, nodes.highway1Node2.id), Map("highway" -> "motorway"), - None + Some(OsmEntity.MetaInformation(Some(0), None, None, None, None, None)) ) val highway2: OpenWay = @@ -218,6 +218,14 @@ trait OsmTestData { Some(OsmEntity.MetaInformation(Some(0), None, None, None, None, None)) ) + val highway4: OpenWay = + OpenWay( + 114L, + Seq(nodes.highway1Node1.id, nodes.highway1Node2.id), + Map("highway" -> "motorway"), + None + ) + val landuse1: ClosedWay = ClosedWay( 121L, Seq( @@ -228,7 +236,7 @@ trait OsmTestData { nodes.landuse1Node1.id ), Map("landuse" -> "education"), - None + Some(OsmEntity.MetaInformation(Some(0), None, None, None, None, None)) ) val landuse2: ClosedWay = ClosedWay( @@ -241,11 +249,11 @@ trait OsmTestData { nodes.landuse2Node1.id ), Map.empty[String, String], - None + Some(OsmEntity.MetaInformation(Some(0), None, None, None, None, None)) ) val landuse3: ClosedWay = ClosedWay( - 122L, + 123L, Seq( nodes.landuse3Node1.id, nodes.landuse3Node2.id, @@ -254,7 +262,7 @@ trait OsmTestData { nodes.landuse3Node1.id ), Map("landuse" -> "residential"), - None + Some(OsmEntity.MetaInformation(Some(0), None, None, None, None, None)) ) val boundaryWay1: OpenWay = OpenWay(