Class ConnectoidHelper
- java.lang.Object
-
- org.goplanit.osm.converter.zoning.handler.helper.ConnectoidHelper
-
public class ConnectoidHelper extends Object
Class to provide functionality for parsing PLANit connectoids from OSM entities- Author:
- markr
-
-
Constructor Summary
Constructors Constructor Description ConnectoidHelper(Zoning zoning, OsmZoningReaderData zoningReaderData, OsmPublicTransportReaderSettings transferSettings, OsmZoningHandlerProfiler profiler)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<DirectedConnectoid>
createAndRegisterDirectedConnectoidsOnTopOfTransferZone(TransferZone transferZone, MacroscopicNetworkLayer networkLayer, Mode planitMode, PlanitJtsCrsUtils geoUtils)
Create directed connectoids for transfer zones that reside on osw ways.boolean
extractDirectedConnectoids(de.topobyte.osm4j.core.model.iface.OsmNode osmNode, Map<String,String> tags, Collection<TransferZone> transferZones, Collection<Mode> planitModes, TransferZoneGroup transferZoneGroup)
create and/or update directed connectoids for the transfer zones and mode combinations when eligible, based on the passed in OSM node where the connectoids access link segments are extracted fromboolean
extractDirectedConnectoidsForMode(de.topobyte.osm4j.core.model.iface.OsmNode osmNode, TransferZone transferZone, Mode planitMode, PlanitJtsCrsUtils geoUtils)
create and/or update directed connectoids for the given mode and layer based on the passed in osm node (location) where the connectoids access link segments are extracted for.boolean
extractDirectedConnectoidsForMode(org.locationtech.jts.geom.Point location, TransferZone transferZone, Mode planitMode, Collection<Link> eligibleAccessLinks, PlanitJtsCrsUtils geoUtils)
create and/or update directed connectoids for the given mode and layer based on the passed in location where the connectoids access link segments are extracted for.void
extractDirectedConnectoidsForStandAloneTransferZoneByPlanitLink(long osmWaitingAreaId, org.locationtech.jts.geom.Geometry waitingAreaGeometry, Link accessLink, TransferZone transferZone, Mode accessMode, double maxAllowedStopToTransferZoneDistanceMeters, MacroscopicNetworkLayer networkLayer)
create connectoids not based on osm node location but based on auto-generated geographic location on the provided link's link segments by finding either a close enough existing coordinate (osm node), or if not close enough a newly created coordinate at the appropriate position.org.locationtech.jts.geom.Point
findConnectoidLocationForstandAloneTransferZoneOnLink(TransferZone transferZone, Link accessLink, Mode accessMode, double maxAllowedStopToTransferZoneDistanceMeters, MacroscopicNetworkLayer networkLayer)
find a suitable connectoid location on the given link based on the constraints that it must be able to reside on a linksegment that is in the correct relative position to the transfer zone and supports the access mode on at least one of the designated link segment(s) that is eligible (if any).protected OsmNetworkToZoningReaderData
getNetworkToZoningData()
collect network to zoning data from settingsprotected OsmPublicTransportReaderSettings
getSettings()
Collect the pt settingsprotected boolean
hasNetworkLayersWithActiveOsmNode(long osmNodeId)
Verify if there exist any layers where the node is active either as an extreme node or internal to a PLANit link
-
-
-
Constructor Detail
-
ConnectoidHelper
public ConnectoidHelper(Zoning zoning, OsmZoningReaderData zoningReaderData, OsmPublicTransportReaderSettings transferSettings, OsmZoningHandlerProfiler profiler)
Constructor- Parameters:
zoning
- to parse onzoningReaderData
- to usetransferSettings
- to useprofiler
- to use
-
-
Method Detail
-
findConnectoidLocationForstandAloneTransferZoneOnLink
public org.locationtech.jts.geom.Point findConnectoidLocationForstandAloneTransferZoneOnLink(TransferZone transferZone, Link accessLink, Mode accessMode, double maxAllowedStopToTransferZoneDistanceMeters, MacroscopicNetworkLayer networkLayer) throws PlanItException
find a suitable connectoid location on the given link based on the constraints that it must be able to reside on a linksegment that is in the correct relative position to the transfer zone and supports the access mode on at least one of the designated link segment(s) that is eligible (if any). If not possible null is returned- Parameters:
transferZone
- to find location foraccessLink
- to find location onaccessMode
- to be compatible withmaxAllowedStopToTransferZoneDistanceMeters
- the maximum allowed distance between stop and waiting area that we allownetworkLayer
- to use- Returns:
- found location either exisiting osm node or projected location that is nearest and does not exist as a shape point on the link yet, or null if no valid position could be found
- Throws:
PlanItException
- thrown if error
-
createAndRegisterDirectedConnectoidsOnTopOfTransferZone
public Collection<DirectedConnectoid> createAndRegisterDirectedConnectoidsOnTopOfTransferZone(TransferZone transferZone, MacroscopicNetworkLayer networkLayer, Mode planitMode, PlanitJtsCrsUtils geoUtils) throws PlanItException
Create directed connectoids for transfer zones that reside on osw ways. For such transfer zones, we simply create connectoids in both directions for all eligible incoming link segments. This is a special case because due to residing on the osm way it is not possible to distinguish what intended direction of the osm way is serviced (it is neither left nor right of the way). Therefore any attempt to extract this information is bypassed here.- Parameters:
transferZone
- residing on an osm waynetworkLayer
- related to the modeplanitMode
- the connectoid is accessible forgeoUtils
- to use- Returns:
- created connectoids, null if it was not possible to create any due to some reason
- Throws:
PlanItException
- thrown if error
-
extractDirectedConnectoidsForMode
public boolean extractDirectedConnectoidsForMode(org.locationtech.jts.geom.Point location, TransferZone transferZone, Mode planitMode, Collection<Link> eligibleAccessLinks, PlanitJtsCrsUtils geoUtils) throws PlanItException
create and/or update directed connectoids for the given mode and layer based on the passed in location where the connectoids access link segments are extracted for. Each of the connectoids is related to the passed in transfer zone. Generally a single connectoid is created for the most likely link segment identified, i.e., if the transfer zone is placed on the left of the infrastructure, the closest by incoming link segment to the given location is used. Since the geometry of a link applies to both link segments we define closest based on the driving position of the country, so a left-hand drive country will use the incoming link segment where the transfer zone is placed on the left, etc.- Parameters:
location
- to create the access point for as planit node (one or more upstream planit link segments will act as access link segment for the created connectoid(s))transferZone
- this connectoid is assumed to provide access toplanitMode
- this connectoid is allowed access foreligibleAccessLinks
- only links in this collection are considered when compatible with provided locationgeoUtils
- used when location of transfer zone relative to infrastructure is to be determined- Returns:
- true when one or more connectoids have successfully been generated or existing connectoids have bee reused, false otherwise
- Throws:
PlanItException
- thrown if error
-
extractDirectedConnectoidsForMode
public boolean extractDirectedConnectoidsForMode(de.topobyte.osm4j.core.model.iface.OsmNode osmNode, TransferZone transferZone, Mode planitMode, PlanitJtsCrsUtils geoUtils) throws PlanItException
create and/or update directed connectoids for the given mode and layer based on the passed in osm node (location) where the connectoids access link segments are extracted for. Each of the connectoids is related to the passed in transfer zone.- Parameters:
osmNode
- to relate to planit network's incoming link segments as access pointstransferZone
- this connectoid is assumed to provide access toplanitMode
- this connectoid is allowed access forgeoUtils
- used to determine location of transfer zone relative to infrastructure to identify which link segment(s) are eligible for connectoids placement- Returns:
- true when one or more connectoids have successfully been generated or existing connectoids have bee reused, false otherwise
- Throws:
PlanItException
- thrown if error
-
extractDirectedConnectoids
public boolean extractDirectedConnectoids(de.topobyte.osm4j.core.model.iface.OsmNode osmNode, Map<String,String> tags, Collection<TransferZone> transferZones, Collection<Mode> planitModes, TransferZoneGroup transferZoneGroup) throws PlanItException
create and/or update directed connectoids for the transfer zones and mode combinations when eligible, based on the passed in OSM node where the connectoids access link segments are extracted from- Parameters:
osmNode
- to relate to planit network's incoming link segments as access pointstags
- to usetransferZones
- connectoids are assumed to provide access toplanitModes
- this connectoid is allowed access fortransferZoneGroup
- it belongs to, when zone is not yet in the group the zone is added to the group (group is allowed to be null)- Returns:
- true when at least connectoids where created for one of the transfer zones identified
- Throws:
PlanItException
- thrown if error
-
extractDirectedConnectoidsForStandAloneTransferZoneByPlanitLink
public void extractDirectedConnectoidsForStandAloneTransferZoneByPlanitLink(long osmWaitingAreaId, org.locationtech.jts.geom.Geometry waitingAreaGeometry, Link accessLink, TransferZone transferZone, Mode accessMode, double maxAllowedStopToTransferZoneDistanceMeters, MacroscopicNetworkLayer networkLayer) throws PlanItException
create connectoids not based on osm node location but based on auto-generated geographic location on the provided link's link segments by finding either a close enough existing coordinate (osm node), or if not close enough a newly created coordinate at the appropriate position. then create connectoids accordingly by breaking the link in these locations- Parameters:
osmWaitingAreaId
- the waiting area pertains towaitingAreaGeometry
- geometry of the waiting areaaccessLink
- to create connectoids on by breaking ittransferZone
- to register connectoids onaccessMode
- eligible mode for the stationmaxAllowedStopToTransferZoneDistanceMeters
- the maximum allowed distance between stop and waiting area that we allownetworkLayer
- the modes relate to- Throws:
PlanItException
- thrown if error
-
getSettings
protected OsmPublicTransportReaderSettings getSettings()
Collect the pt settings- Returns:
- pulibc transport settings
-
getNetworkToZoningData
protected OsmNetworkToZoningReaderData getNetworkToZoningData()
collect network to zoning data from settings- Returns:
- network to zoning data
-
hasNetworkLayersWithActiveOsmNode
protected boolean hasNetworkLayersWithActiveOsmNode(long osmNodeId) throws PlanItException
Verify if there exist any layers where the node is active either as an extreme node or internal to a PLANit link- Parameters:
osmNodeId
- to use- Returns:
- true when one or more layers are found, false otherwise
- Throws:
PlanItException
- thrown if error
-
-