Class PlanitEntityGeoUtils


  • public class PlanitEntityGeoUtils
    extends Object
    • Constructor Detail

      • PlanitEntityGeoUtils

        public PlanitEntityGeoUtils()
    • Method Detail

      • getDistanceToZone

        public static double getDistanceToZone​(org.locationtech.jts.geom.Coordinate coord,
                                               Zone zone,
                                               PlanitJtsCrsUtils geoUtils)
        find the distance from the zone to the coordinate. This method computes the actual distance between any location on any line segment of the outer boundary of the zones (or its centroid if no polygon/linestring is available) and the reference point and it is therefore very precise.
        Parameters:
        coord - used
        zone - to check against using its geometry
        geoUtils - to compute projected distances
        Returns:
        distance to zone, if not possible to compute positive infinity is returned
      • getDistanceToEdge

        public static double getDistanceToEdge​(org.locationtech.jts.geom.Coordinate coord,
                                               Edge edge,
                                               PlanitJtsCrsUtils geoUtils)
        find the distance from the edge to the point. This method computes the actual distance between any location on any line segment of the edge and the reference node and it is therefore very precise.
        Parameters:
        coord - used
        edge - to check against using its geometry
        geoUtils - to compute projected distances
        Returns:
        distance to edge, if not possible to compute positive infinity is returned
      • findPlanitEntityClosest

        public static <T> Pair<T,​Double> findPlanitEntityClosest​(org.locationtech.jts.geom.Coordinate coord,
                                                                       Collection<? extends T> planitEntities,
                                                                       boolean suppressLogging,
                                                                       PlanitJtsCrsUtils geoUtils)
        Type Parameters:
        T - type of the PLANit entity
        Parameters:
        coord - reference location
        planitEntities - to check against using their geometries
        suppressLogging - when true suppress logging, false otherwise
        geoUtils - to compute projected distances
        Returns:
        planitEntity closest and distance in meters
      • findPlanitEntityClosest

        public static <T> Pair<T,​Double> findPlanitEntityClosest​(org.locationtech.jts.geom.Coordinate coord,
                                                                       Collection<? extends T> planitEntities,
                                                                       double maxDistanceMeters,
                                                                       boolean suppressLogging,
                                                                       PlanitJtsCrsUtils geoUtils)
        find the closest distance to the coordinate for some PLANit entity with a supported geometry from the provided collection. This method computes the actual distance between any location on any line segment of the (outer) boundary of the planit entities geometry (or its point location if no polygon/linestring is available) and the reference node and it is therefore very precise. A cap is placed on how far a zone is allowed to be to still be regarded as closest via maxDistanceMeters.
        Type Parameters:
        T - type of the PLANit entity
        Parameters:
        coord - reference location
        planitEntities - to check against using their geometries
        maxDistanceMeters - maximum allowedDistance to be eligible
        suppressLogging - when true suppress logging, false otherwise
        geoUtils - to compute projected distances
        Returns:
        planitEntity closest and distance in meters, null if none matches criteria
      • extractClosestLineSegmentToGeometryFromLinkSegment

        public static org.locationtech.jts.geom.LineSegment extractClosestLineSegmentToGeometryFromLinkSegment​(org.locationtech.jts.geom.Geometry referenceGeometry,
                                                                                                               LinkSegment linkSegment,
                                                                                                               PlanitJtsCrsUtils geoUtils)
        Extract the closest existing linear line segment based on the closest two coordinates on the link segment geometry in its intended direction to the reference geometry provided
        Parameters:
        referenceGeometry - to find closest line segment to
        linkSegment - to extract line segment from
        geoUtils - for distance calculations
        Returns:
        line segment if found
      • extractClosestProjectedLinearLocationToGeometryFromEdge

        public static org.locationtech.jts.linearref.LinearLocation extractClosestProjectedLinearLocationToGeometryFromEdge​(org.locationtech.jts.geom.Geometry referenceGeometry,
                                                                                                                            Edge accessEdge,
                                                                                                                            PlanitJtsCrsUtils geoUtils)
        Find the linear location reflecting the closest projected location between the transfer zone and link geometries. For the transfer zone geometry we use existing coordinates rather than projected ones
        Parameters:
        referenceGeometry - to use
        accessEdge - to use
        geoUtils - to use
        Returns:
        closest projected linear location on link geometry