RoadNetwork¶
-
public class
RoadNetwork
¶ Routable road network built from the shapefiles.
Author: Milan Lovric
Fields¶
Constructors¶
RoadNetwork¶
-
public
RoadNetwork
(URL zonesUrl, URL networkUrl, URL nodesUrl, URL AADFurl, String areaCodeFileName, String areaCodeNearestNodeFile, String workplaceZoneFileName, String workplaceZoneNearestNodeFile, String freightZoneToLADfile, String freightZoneNearestNodeFile, Properties params)¶ Parameters: - zonesUrl – Url for the shapefile with zone polygons.
- networkUrl – Url for the shapefile with road network.
- nodesUrl – Url for the shapefile with nodes.
- AADFurl – Url for the shapefile with AADF counts.
- areaCodeFileName – Path to the file with census output areas.
- areaCodeNearestNodeFile – Path to the file with nearest nodes to output area centroids.
- workplaceZoneFileName – Path to the file with workplace zones.
- workplaceZoneNearestNodeFile – Path to the file with nearest nodes to workplace zone centroids.
- freightZoneToLADfile – Path to the file with freight zone to LAD mapping.
- freightZoneNearestNodeFile – Path to the file with nearest nodes to freight zones that are points.
- params – Properties with parameters from the config file.
Throws: - IOException – if any.
Methods¶
addRoadLink¶
-
public void
addRoadLink
(Edge edge)¶ This adds edge (including its object) to the network - useful for restoring from a list of removed edges (e.g. during disruption).
Parameters: - edge – Edge to be added to the network.
createCustomFeatureType¶
createNetworkFeatureCollection¶
-
public SimpleFeatureCollection
createNetworkFeatureCollection
(Map<Integer, Double> linkData, String linkDataLabel, String shapefilePath)¶ Creates a custom feature collection for the network.
Parameters: - linkData – Data assigned to network links.
- linkDataLabel – The label of the link data.
- shapefilePath – The path to the shapefile into which data will be stored.
Throws: - IOException – if any.
Returns: Feature collection.
createNewRoadLink¶
-
public Edge
createNewRoadLink
(Node fromNode, Node toNode, int numberOfLanes, char roadCategory, double length, int edgeID)¶ Creates a new (unidirectional) road link (edge) between existing intersections (nodes).
Parameters: - fromNode – Start node of the new road link.
- toNode – End node of the new road link.
- numberOfLanes – Number of lanes in the road link.
- roadCategory – Road category.
- length – Length of the road link.
Returns: Newly created edge.
exportToShapefile¶
getAADFCarTrafficCounts¶
getAADFFreightTrafficCounts¶
-
public Map<VehicleType, Integer[]>
getAADFFreightTrafficCounts
()¶ Get car traffic counts data for each link (for combined counts return 1/2 of the count per direction).
Returns: AADF traffic counts per freight vehicle type and per link.
getAreaCodeToNearestNodeID¶
getAreaCodeToPopulation¶
getAstarFunctions¶
-
public AStarIterator.AStarFunctions
getAstarFunctions
(Node destinationNode)¶ Getter method for the AStar functions (edge cost and heuristic function) based on distance.
Parameters: - destinationNode – Destination node.
Returns: AStar functions.
getAstarFunctionsTime¶
-
public AStarIterator.AStarFunctions
getAstarFunctionsTime
(Node destinationNode, double[] linkTravelTime)¶ Getter method for the AStar functions (edge cost and heuristic function) based on travel time.
Parameters: - destinationNode – Destination node.
- linkTravelTime – Link travel times to use for edge weighting.
Returns: AStar functions.
getAverageAcessEgressDistance¶
-
public double
getAverageAcessEgressDistance
(int node)¶ Average access/egress distance to access a node that has gravitating population.
Parameters: - node – Node to which
Returns: Gravitating population.
getAverageAcessEgressDistanceFreight¶
-
public double
getAverageAcessEgressDistanceFreight
(int node)¶ Average access/egress distance to access a node that has gravitating population.
Parameters: - node – Node to which
Returns: Gravitating population.
getDijkstraTimeWeighter¶
-
public DijkstraIterator.EdgeWeighter
getDijkstraTimeWeighter
(double[] linkTravelTime)¶ Getter method for the Dijkstra edge weighter with time.
Parameters: - linkTravelTime – Link travel times to use for edge weighting.
Returns: Dijkstra edge weighter with time.
getDijkstraWeighter¶
-
public DijkstraIterator.EdgeWeighter
getDijkstraWeighter
()¶ Getter method for the Dijkstra edge weighter.
Returns: Dijkstra edge weighter.
getEdgeIDtoEdge¶
-
public Edge[]
getEdgeIDtoEdge
()¶ Getter method for edgeID to edge mapping.
Returns: Edge ID to edge mapping.
getEdgeIDtoOtherDirectionEdgeID¶
getEdgeLength¶
-
public double
getEdgeLength
(int edgeID)¶ Gets edge length for a given edge ID.
Parameters: - edgeID – Edge ID.
Returns: Edge length.
getEdgeToZone¶
getEdgesType¶
getFastestPath¶
-
public RoadPath
getFastestPath
(DirectedNode from, DirectedNode to, double[] linkTravelTime)¶ Gets the fastest path between two nodes using astar algorithm and provided link travel times. Links which have no travel time provided will use free flow travel times.
Parameters: - from – Origin node.
- to – Destination node.
- linkTravelTime – The map with link travel times.
Returns: Fastest path.
getFastestPathDijkstra¶
-
public RoadPath
getFastestPathDijkstra
(DirectedNode from, DirectedNode to, double[] linkTravelTime)¶ Gets the fastest path between two nodes using Dijkstra’s algorithm and provided link travel times. Links which have no travel time provided will use free flow travel times.
Parameters: - from – Origin node.
- to – Destination node.
- linkTravelTime – The map with link travel times.
Returns: Fastest path.
getFreeFlowTravelTime¶
-
public double[]
getFreeFlowTravelTime
()¶ Getter method for free flow travel time.
Returns: Free flow travel time.
getFreightZoneToLAD¶
getFreightZoneToNearestNode¶
getGravitatingPopulation¶
-
public int
getGravitatingPopulation
(int node)¶ Population gravitating to a node.
Parameters: - node – Node to which the population gravitates.
Returns: Gravitating population.
getGravitatingWorkplacePopulation¶
-
public int
getGravitatingWorkplacePopulation
(int node)¶ Workplace population gravitating to a node.
Parameters: - node – Node to which the workplace population gravitates.
Returns: Gravitating workplace population.
getIsEdgeUrban¶
getMaximumEdgeID¶
-
public int
getMaximumEdgeID
()¶ Getter method for maximum edge ID.
Returns: Maximum edge ID.
getMaximumNodeID¶
-
public int
getMaximumNodeID
()¶ Getter method for maximum node ID.
Returns: Maximum node ID.
getNetwork¶
-
public DirectedGraph
getNetwork
()¶ Getter method for the road network.
Returns: Directed graph representation of the road network.
getNodeIDtoNode¶
-
public Node[]
getNodeIDtoNode
()¶ Getter method for nodeID to node mapping.
Returns: Node ID to node mapping.
getNodeToAverageAccessEgressDistance¶
-
public double[]
getNodeToAverageAccessEgressDistance
()¶ Getter method for the node to average access/egress distance mapping [in metres].
Returns: Node ID to average access/egress distance mapping.
getNodeToAverageAccessEgressDistanceFreight¶
-
public double[]
getNodeToAverageAccessEgressDistanceFreight
()¶ Getter method for the node to average access/egress distance mapping for freight [in metres].
Returns: Node ID to average access/egress distance mapping for freight.
getNodeToGravitatingPopulation¶
-
public int[]
getNodeToGravitatingPopulation
()¶ Getter method for the node to gravitating population mapping.
Returns: Node to gravitating population mapping.
getNodeToZone¶
getNumberOfLanes¶
-
public int[]
getNumberOfLanes
()¶ Getter method for the number of lanes for each link.
Returns: Link id to number of lanes mapping.
getWorkplaceCodeToPopulation¶
getWorkplaceZoneToNearestNode¶
getZoneToAreaCodes¶
getZoneToNodes¶
getZoneToWorkplaceCodes¶
isBlacklistedAsEndNode¶
-
public boolean
isBlacklistedAsEndNode
(int nodeId)¶ Finds out if the node is blacklisted as a path end node.
Parameters: - nodeId – Node ID.
Returns: Whether nodes is blacklisted or not.
isBlacklistedAsStartNode¶
-
public boolean
isBlacklistedAsStartNode
(int nodeId)¶ Finds out if the node is blacklisted as a path start node.
Parameters: - nodeId – Node ID.
Returns: Whether nodes is blacklisted or not.
makeEdgesAdmissible¶
-
public void
makeEdgesAdmissible
()¶ Overrides actual edge lengths with straight line distances, when they are smaller than straight line distances.
removeRoadLink¶
-
public void
removeRoadLink
(Edge edge)¶ Removes an edge from the road network.
Parameters: - edge – Edge to remove from the road network.
replaceNetworkEdgeIDs¶
sortGravityNodes¶
-
public void
sortGravityNodes
()¶ For each zone (LAD) sorts the list of contained nodes based on the gravitating population.