Package org.goplanit.utils.geo
Class PlanitEntityGeoUtils
- java.lang.Object
-
- org.goplanit.utils.geo.PlanitEntityGeoUtils
-
public class PlanitEntityGeoUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description PlanitEntityGeoUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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 providedstatic 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.static <T> Pair<T,Double>
findPlanitEntityClosest(org.locationtech.jts.geom.Coordinate coord, Collection<? extends T> planitEntities, boolean suppressLogging, PlanitJtsCrsUtils geoUtils)
identical tofindPlanitEntityClosest(Coordinate, Collection, double, boolean, PlanitJtsCrsUtils)
but without a distance criteriastatic <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.static double
getDistanceToEdge(org.locationtech.jts.geom.Coordinate coord, Edge edge, PlanitJtsCrsUtils geoUtils)
find the distance from the edge to the point.static double
getDistanceToZone(org.locationtech.jts.geom.Coordinate coord, Zone zone, PlanitJtsCrsUtils geoUtils)
find the distance from the zone to the coordinate.
-
-
-
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
- usedzone
- to check against using its geometrygeoUtils
- 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
- usededge
- to check against using its geometrygeoUtils
- 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)
identical tofindPlanitEntityClosest(Coordinate, Collection, double, boolean, PlanitJtsCrsUtils)
but without a distance criteria- Type Parameters:
T
- type of the PLANit entity- Parameters:
coord
- reference locationplanitEntities
- to check against using their geometriessuppressLogging
- when true suppress logging, false otherwisegeoUtils
- 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 locationplanitEntities
- to check against using their geometriesmaxDistanceMeters
- maximum allowedDistance to be eligiblesuppressLogging
- when true suppress logging, false otherwisegeoUtils
- 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 tolinkSegment
- to extract line segment fromgeoUtils
- 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 useaccessEdge
- to usegeoUtils
- to use- Returns:
- closest projected linear location on link geometry
-
-