Class WaterWayCheck

  • All Implemented Interfaces:
    java.io.Serializable, Check

    public class WaterWayCheck
    extends BaseCheck<java.lang.Long>
    This check flags waterways that do not have a sink (i.e., are not connected to another waterway), are circular (so first node and last node are the same), or cross another waterway with the same layer. It also looks for ways that may be going uphill (requires elevation data, see ElevationUtilities
    See Also:
    Serialized Form
    • Constructor Detail

      • WaterWayCheck

        public WaterWayCheck​(org.openstreetmap.atlas.utilities.configuration.Configuration configuration,
                             ExternalDataFetcher fileFetcher)
        Default constructor
        Parameters:
        configuration - the JSON configuration for this check
        fileFetcher - The file fetcher to use to get data files
    • Method Detail

      • getIntersectingSegments

        public static java.util.Collection<org.apache.commons.lang3.tuple.Pair<org.openstreetmap.atlas.geography.Segment,​org.openstreetmap.atlas.geography.Segment>> getIntersectingSegments​(org.openstreetmap.atlas.geography.PolyLine left,
                                                                                                                                                                                                   org.openstreetmap.atlas.geography.PolyLine right)
        Get intersecting segments of two polylines
        Parameters:
        left - The polyline whose segments will go in the key/left side of the pair
        right - The polyline whose segments will go in the value/right side of the pair
        Returns:
        A collection of segments intersecting other segments. A segment *may* appear more than once.
      • doesLineEndInOcean

        public boolean doesLineEndInOcean​(org.openstreetmap.atlas.geography.atlas.Atlas atlas,
                                          org.openstreetmap.atlas.geography.atlas.items.LineItem line)
        Check if a line ends in an ocean
        Parameters:
        atlas - The atlas of the object
        line - The line to check
        Returns:
        true if the line ends in an ocean
      • doesLineEndInSink

        public boolean doesLineEndInSink​(org.openstreetmap.atlas.geography.atlas.Atlas atlas,
                                         org.openstreetmap.atlas.geography.atlas.items.LineItem lineItem)
        Check if a line ends in a waterway sink
        Parameters:
        atlas - The atlas of the object
        lineItem - The LineItem to check
        Returns:
        true if the waterway can reasonably be expected to end
      • doesLineEndOnWaterway

        public boolean doesLineEndOnWaterway​(org.openstreetmap.atlas.geography.atlas.Atlas atlas,
                                             org.openstreetmap.atlas.geography.atlas.items.LineItem line)
        Check if the last location on a line also happens to be connected to a waterway.
        Parameters:
        atlas - The atlas of the object
        line - The line to check
        Returns:
        true if the line ends on a waterway (the last node is part of a waterway)
      • isRightOf

        public boolean isRightOf​(org.openstreetmap.atlas.geography.PolyLine line,
                                 org.openstreetmap.atlas.geography.Location location)
        Check if a location is to the right of a line (e.g., kerbs, cliffs, and oceans)
        Parameters:
        line - The line to compare the location to
        location - The location
        Returns:
        true if the location is to the right of the line. If the location is on the line, or to the left of the line, we return false.
      • isValidEndToCheck

        public boolean isValidEndToCheck​(org.openstreetmap.atlas.geography.atlas.Atlas atlas,
                                         org.openstreetmap.atlas.geography.Location location)
        Check if a location is inside an atlas bounds
        Parameters:
        atlas - The atlas
        location - The location to check
        Returns:
        true if the atlas contains the location inside its bounds
      • validCheckForObject

        public boolean validCheckForObject​(org.openstreetmap.atlas.geography.atlas.items.AtlasObject object)
        Description copied from interface: Check
        Checks to see whether the supplied object class type is valid for this particular check
        Parameters:
        object - The AtlasObject you are checking
        Returns:
        true if it is
      • flag

        protected java.util.Optional<CheckFlag> flag​(org.openstreetmap.atlas.geography.atlas.items.AtlasObject object)
        Specified by:
        flag in class BaseCheck<java.lang.Long>
      • getFallbackInstructions

        protected java.util.List<java.lang.String> getFallbackInstructions()
        Description copied from class: BaseCheck
        Method to implement for inheriting checks to return the default set of instruction formats that will be the last resort in BaseCheck.getLocalizedInstruction(int, Object[])
        Overrides:
        getFallbackInstructions in class BaseCheck<java.lang.Long>
        Returns:
        The set of instructions to fall back to if configuration results in none.