Class CellIterator

    • Constructor Detail

      • CellIterator

        public CellIterator​(SortedSet<OSHDBTimestamp> timestamps,
                            OSHDBBoundingBox boundingBox,
                            P boundingPolygon,
                            TagInterpreter tagInterpreter,
                            OSHEntityFilter oshEntityPreFilter,
                            OSMEntityFilter osmEntityFilter,
                            boolean includeOldStyleMultipolygons)
        Creates a cell iterator from a bounding box and a bounding polygon.
        Type Parameters:
        P - either Polygon or MultiPolygon
        Parameters:
        timestamps - a list of timestamps to return data for
        boundingBox - only entities inside or intersecting this bbox are returned, geometries are clipped to this extent
        tagInterpreter - helper object which is used to determine entitie's geometry types
        boundingPolygon - only entities inside or intersecting this polygon are returned, geometries are clipped to this extent. If present, the supplied boundingBox must be the boundingBox of this polygon
        oshEntityPreFilter - (optional) a lambda called for each osh entity to pre-filter elements. only if it returns true, its osmEntity objects can be included in the output
        osmEntityFilter - a lambda called for each entity. if it returns true, the particular feature is included in the output
        includeOldStyleMultipolygons - if true, output contains also data for "old style multipolygons". Note, that if includeOldStyleMultipolygons is true, for each old style multipolygon only the geometry of the inner holes are returned (while the outer part is already present as the respective way's output)! This has to be interpreted separately and differently in the data analysis! The includeOldStyleMultipolygons is also quite a bit less efficient (both CPU and memory) as the default path.
      • CellIterator

        public CellIterator​(SortedSet<OSHDBTimestamp> timestamps,
                            @Nonnull
                            P boundingPolygon,
                            TagInterpreter tagInterpreter,
                            OSHEntityFilter oshEntityPreFilter,
                            OSMEntityFilter osmEntityFilter,
                            boolean includeOldStyleMultipolygons)
        Creates a cell iterator from a bounding polygon.
        Type Parameters:
        P - either Polygon or MultiPolygon
        Parameters:
        timestamps - a list of timestamps to return data for
        tagInterpreter - helper object which is used to determine entitie's geometry types
        boundingPolygon - only entities inside or intersecting this polygon are returned, geometries are clipped to this extent.
        oshEntityPreFilter - (optional) a lambda called for each osh entity to pre-filter elements. only if it returns true, its osmEntity objects can be included in the output
        osmEntityFilter - a lambda called for each entity. if it returns true, the particular feature is included in the output
        includeOldStyleMultipolygons - if true, output contains also data for "old style multipolygons". Note, that if includeOldStyleMultipolygons is true, for each old style multipolygon only the geometry of the inner holes are returned (while the outer part is already present as the respective way's output)! This has to be interpreted separately and differently in the data analysis! The includeOldStyleMultipolygons is also quite a bit less efficient (both CPU and memory) as the default path.
      • CellIterator

        public CellIterator​(SortedSet<OSHDBTimestamp> timestamps,
                            OSHDBBoundingBox boundingBox,
                            TagInterpreter tagInterpreter,
                            OSHEntityFilter oshEntityPreFilter,
                            OSMEntityFilter osmEntityFilter,
                            boolean includeOldStyleMultipolygons)
        Creates a cell iterator from a bounding box.
        Parameters:
        timestamps - a list of timestamps to return data for
        tagInterpreter - helper object which is used to determine entitie's geometry types
        boundingBox - only entities inside or intersecting this bbox are returned, geometries are clipped to this extent
        oshEntityPreFilter - (optional) a lambda called for each osh entity to pre-filter elements. only if it returns true, its osmEntity objects can be included in the output
        osmEntityFilter - a lambda called for each entity. if it returns true, the particular feature is included in the output
        includeOldStyleMultipolygons - if true, output contains also data for "old style multipolygons". Note, that if includeOldStyleMultipolygons is true, for each old style multipolygon only the geometry of the inner holes are returned (while the outer part is already present as the respective way's output)! This has to be interpreted separately and differently in the data analysis! The includeOldStyleMultipolygons is also quite a bit less efficient (both CPU and memory) as the default path.
    • Method Detail

      • iterateByTimestamps

        public Stream<CellIterator.IterateByTimestampEntry> iterateByTimestamps​(GridOSHEntity cell)
        Helper method to easily iterate over all entities in a cell that match a given condition/filter as they existed at the given timestamps.
        Parameters:
        cell - the data cell
        Returns:
        a stream of matching filtered OSMEntities with their clipped Geometries at each timestamp. If an object has not been modified between timestamps, the output may contain the *same* Geometry object in the output multiple times. This can be used to optimize away recalculating expensive geometry operations on unchanged feature geometries later on in the code.
      • iterateByTimestamps

        public Stream<CellIterator.IterateByTimestampEntry> iterateByTimestamps​(Iterable<? extends OSHEntity> cellData,
                                                                                boolean allFullyInside)
        Helper method to easily iterate over all entities in a cell that match a given condition/filter as they existed at the given timestamps.
        Parameters:
        cellData - the entities to iterate through
        allFullyInside - indicator that exact geometry inclusion checks can be skipped
        Returns:
        a stream of matching filtered OSMEntities with their clipped Geometries at each timestamp. If an object has not been modified between timestamps, the output may contain the *same* Geometry object in the output multiple times. This can be used to optimize away recalculating expensive geometry operations on unchanged feature geometries later on in the code.
      • iterateByContribution

        public Stream<CellIterator.IterateAllEntry> iterateByContribution​(GridOSHEntity cell)
        Helper method to easily iterate over all entity modifications in a cell that match a given condition/filter.
        Parameters:
        cell - the data cell
        Returns:
        a stream of matching filtered OSMEntities with their clipped Geometries and timestamp intervals.
      • iterateByContribution

        public Stream<CellIterator.IterateAllEntry> iterateByContribution​(Iterable<? extends OSHEntity> cellData,
                                                                          boolean allFullyInside)
        Helper method to easily iterate over all entity modifications in a cell that match a given condition/filter.
        Parameters:
        cellData - the entities to iterate through
        allFullyInside - indicator that exact geometry inclusion checks can be skipped
        Returns:
        a stream of matching filtered OSMEntities with their clipped Geometries and timestamp intervals.