Class PlanitLinkUtils


  • public class PlanitLinkUtils
    extends Object
    Utilities regarding PLANit links useful when parsing OSM entities
    Author:
    markr
    • Constructor Detail

      • PlanitLinkUtils

        public PlanitLinkUtils()
    • Method Detail

      • excludeLinksOnWrongSideOf

        public static Collection<Link> excludeLinksOnWrongSideOf​(org.locationtech.jts.geom.Geometry waitingAreaGeometry,
                                                                 Collection<Link> links,
                                                                 boolean isLeftHandDrive,
                                                                 Collection<Mode> accessModes,
                                                                 PlanitJtsCrsUtils geoUtils)
                                                          throws PlanItException
        create a subset of links from the passed in ones, removing all links for which we can be certain that geometry is located on the wrong side of the road infrastructure geometry. This is verified by checking if the link is one-way. If so, we can be sure (based on the driving direction of the country) if the geometry is located to the closest by (logical) driving direction given the placement of the geometry, i.e., on the left hand side for left hand drive countries, on the right hand side for right hand driving countries
        Parameters:
        waitingAreaGeometry - representing the waiting area (station, platform, pole)
        links - to remove in-eligible ones from
        isLeftHandDrive - flag
        accessModes - to consider
        geoUtils - to use
        Returns:
        remaining links that are deemed eligible
        Throws:
        PlanItException - thrown if error
      • getClosestLinkWithOsmWayIdToGeometry

        public static Link getClosestLinkWithOsmWayIdToGeometry​(long osmWayId,
                                                                org.locationtech.jts.geom.Geometry geometry,
                                                                MacroscopicNetworkLayer networkLayer,
                                                                PlanitJtsCrsUtils geoUtils)
                                                         throws PlanItException
        Collect the closest by link (with the given OSM way id on the layer) to the provided geometry. This is a very slow method as we lookup the link via the un-indexed external id. Use cautiously.
        Parameters:
        osmWayId - to filter links on
        geometry - to check closeness against
        networkLayer - the link must reside on
        geoUtils - to use for closeness computations
        Returns:
        found link (null if none)
        Throws:
        PlanItException - thrown if error