Package org.goplanit.osm.util
Class PlanitLinkUtils
- java.lang.Object
-
- org.goplanit.osm.util.PlanitLinkUtils
-
public class PlanitLinkUtils extends Object
Utilities regarding PLANit links useful when parsing OSM entities- Author:
- markr
-
-
Constructor Summary
Constructors Constructor Description PlanitLinkUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Collection<Link>
excludeLinksOnWrongSideOf(org.locationtech.jts.geom.Geometry waitingAreaGeometry, Collection<Link> links, boolean isLeftHandDrive, Collection<Mode> accessModes, PlanitJtsCrsUtils geoUtils)
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.static Link
getClosestLinkWithOsmWayIdToGeometry(long osmWayId, org.locationtech.jts.geom.Geometry geometry, MacroscopicNetworkLayer networkLayer, PlanitJtsCrsUtils geoUtils)
Collect the closest by link (with the given OSM way id on the layer) to the provided geometry.
-
-
-
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 fromisLeftHandDrive
- flagaccessModes
- to considergeoUtils
- 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 ongeometry
- to check closeness againstnetworkLayer
- the link must reside ongeoUtils
- to use for closeness computations- Returns:
- found link (null if none)
- Throws:
PlanItException
- thrown if error
-
-