Class OSHEntityTimeUtils


  • public class OSHEntityTimeUtils
    extends Object
    Utility class for working with OSH entities.

    Includes methods like getting all modifications to an entity recursively (unfiltered or filtered by a given predicate), or getting relevant changeset ids by timestamp.

    • Method Detail

      • getChangesetTimestamps

        public static Map<OSHDBTimestamp,​Long> getChangesetTimestamps​(OSHEntity osh)
        Returns the changeset ids which correspond to modifications of this entity.

        Used internally to group modifications by changeset.

        Parameters:
        osh - the osh entity to work on
        Returns:
        a map between timestamps and changeset ids
      • getModificationTimestamps

        public static List<OSHDBTimestamp> getModificationTimestamps​(OSHEntity osh)
        Returns all timestamps at which this entity (or one or more of its child entities) has been modified.
        Parameters:
        osh - the osh entity to work on
        Returns:
        a list of timestamps where this entity has been modified
      • getModificationTimestamps

        public static List<OSHDBTimestamp> getModificationTimestamps​(OSHEntity osh,
                                                                     boolean recurse)
        Returns the list of timestamps at which this entity was modified.

        If the parameter "recurse" is set to true, it will also include modifications of the object's child elements (useful to find out when the geometry of this object has been altered).

        Parameters:
        osh - the osh entity to work on
        recurse - specifies if times of modifications of child entities should also be returned or not
        Returns:
        a list of timestamps where this entity has been modified
      • getModificationTimestamps

        public static List<OSHDBTimestamp> getModificationTimestamps​(OSHEntity osh,
                                                                     Predicate<OSMEntity> osmEntityFilter,
                                                                     Map<OSHDBTimestamp,​Long> changesetTimestamps)
        Returns all timestamps at which this entity (or one or more of its child entities) has been modified and matches a given condition/filter.

        Consecutive modifications from a single changeset are grouped together (only the last modification timestamp of the corresponding changeset is considered). This can reduce the amount of geometry modifications by a lot (e.g. when sequential node uploads of a way modification causes many intermediate modification states), making results more "accurate"/comparable as well as allowing faster processing of geometries.

        Parameters:
        osh - the osh entity to work on
        osmEntityFilter - only timestamps for which the entity matches this filter are returned
        changesetTimestamps - association between timestamps and changeset-ids, can be obtained from oshEntity by calling getChangesetTimestamps(org.heigit.ohsome.oshdb.osh.OSHEntity).
        Returns:
        a list of timestamps where this entity has been modified
      • getModificationTimestamps

        public static List<OSHDBTimestamp> getModificationTimestamps​(OSHEntity osh,
                                                                     Predicate<OSMEntity> osmEntityFilter)
        Returns all timestamps at which this entity (or one or more of its child entities) has been modified and matches a given condition/filter.
        Parameters:
        osh - the osh entity to work on
        osmEntityFilter - only timestamps for which the entity matches this filter are returned
        Returns:
        a list of timestamps where this entity has been modified