Class OsmConnectoidHelper
- java.lang.Object
-
- org.goplanit.osm.converter.zoning.handler.helper.OsmConnectoidHelper
-
public class OsmConnectoidHelper extends Object
Class to provide functionality for parsing PLANit connectoids from OSM entities- Author:
- markr
-
-
Constructor Summary
Constructors Constructor Description OsmConnectoidHelper(PlanitOsmNetwork referenceNetwork, Zoning zoning, OsmZoningReaderData zoningReaderData, OsmNetworkToZoningReaderData network2ZoningData, 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, PredefinedModeType planitModeType, PlanitJtsCrsUtils geoUtils)
Create directed connectoids for transfer zones that reside on OSM ways.boolean
extractDirectedConnectoids(de.topobyte.osm4j.core.model.iface.OsmNode osmNode, boolean locationIsKnownOsmStopPosition, Collection<TransferZone> transferZones, Collection<PredefinedModeType> planitModeTypes, TransferZoneGroup transferZoneGroup, boolean suppressLogging)
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, boolean locationIsKnownOsmStopPosition, TransferZone transferZone, PredefinedModeType planitModeType, boolean suppressLogging, PlanitJtsCrsUtils geoUtils)
boolean
extractDirectedConnectoidsForMode(org.locationtech.jts.geom.Point location, boolean locationIsKnownOsmStopPosition, TransferZone transferZone, PredefinedModeType planitModeType, boolean suppressLogging, 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, MacroscopicLink accessLink, TransferZone transferZone, PredefinedModeType planitAccessModeType, double maxAllowedStopToTransferZoneDistanceMeters, MacroscopicNetworkLayer networkLayer, boolean suppressLogging)
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, MacroscopicLink accessLink, PredefinedModeType planitModeType, double maxAllowedDistanceMeters)
find a suitable connectoid location on the given link based on the constraints that it must be able to reside on a link segment 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 Pair<Integer,Boolean>
findOsmVerticalLayerIndexByStopPositionPlanitLinks(org.locationtech.jts.geom.Point stopPositionLocation, NetworkLayer layer)
Based on the location of the stop position, determine if the PLANit links that it resides on, or borders or reside in a particular layer.protected OsmNetworkToZoningReaderData
getNetworkToZoningData()
protected PlanitOsmNetwork
getReferenceNetwork()
protected 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
-
OsmConnectoidHelper
public OsmConnectoidHelper(PlanitOsmNetwork referenceNetwork, Zoning zoning, OsmZoningReaderData zoningReaderData, OsmNetworkToZoningReaderData network2ZoningData, OsmPublicTransportReaderSettings transferSettings, OsmZoningHandlerProfiler profiler)
Constructor- Parameters:
referenceNetwork
- to usezoning
- to parse onzoningReaderData
- to usenetwork2ZoningData
- data transferred from parsing network to be used by zoning reader.transferSettings
- to useprofiler
- to use
-
-
Method Detail
-
findConnectoidLocationForStandAloneTransferZoneOnLink
public org.locationtech.jts.geom.Point findConnectoidLocationForStandAloneTransferZoneOnLink(TransferZone transferZone, MacroscopicLink accessLink, PredefinedModeType planitModeType, double maxAllowedDistanceMeters)
find a suitable connectoid location on the given link based on the constraints that it must be able to reside on a link segment 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 null is returned- Parameters:
transferZone
- to find location foraccessLink
- to find location onplanitModeType
- to be compatible withmaxAllowedDistanceMeters
- the maximum allowed distance between stop and waiting area that we allow- Returns:
- found location either existing 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
-
createAndRegisterDirectedConnectoidsOnTopOfTransferZone
public Collection<DirectedConnectoid> createAndRegisterDirectedConnectoidsOnTopOfTransferZone(TransferZone transferZone, MacroscopicNetworkLayer networkLayer, PredefinedModeType planitModeType, PlanitJtsCrsUtils geoUtils)
Create directed connectoids for transfer zones that reside on OSM 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 modeplanitModeType
- the connectoid is accessible forgeoUtils
- to use- Returns:
- created connectoids, null if it was not possible to create any due to some reason
-
extractDirectedConnectoidsForMode
public boolean extractDirectedConnectoidsForMode(org.locationtech.jts.geom.Point location, boolean locationIsKnownOsmStopPosition, TransferZone transferZone, PredefinedModeType planitModeType, boolean suppressLogging, 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. 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))locationIsKnownOsmStopPosition
- when true the location provided is tagged explicitly, meaning we do not enforce filtering based on criteria that might not have been properly tagged, when false, we proceed applying as many filter criteria as possible to get best possible match based on available tagging, e.g., vertical layer informationtransferZone
- this connectoid is assumed to provide access toplanitModeType
- mode type this connectoid is allowed access forsuppressLogging
- when true do not log anything, false otherwisegeoUtils
- 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
-
extractDirectedConnectoidsForMode
public boolean extractDirectedConnectoidsForMode(de.topobyte.osm4j.core.model.iface.OsmNode osmNode, boolean locationIsKnownOsmStopPosition, TransferZone transferZone, PredefinedModeType planitModeType, boolean suppressLogging, PlanitJtsCrsUtils geoUtils)
-
extractDirectedConnectoids
public boolean extractDirectedConnectoids(de.topobyte.osm4j.core.model.iface.OsmNode osmNode, boolean locationIsKnownOsmStopPosition, Collection<TransferZone> transferZones, Collection<PredefinedModeType> planitModeTypes, TransferZoneGroup transferZoneGroup, boolean suppressLogging)
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 pointslocationIsKnownOsmStopPosition
- when true the location provided is tagged explicitly, meaning we do not enforce filtering based on criteria that might not have been properly tagged, when false, we proceed applying as many filter criteria as possible to get the best possible match based on available tagging, e.g., vertical layer informationtransferZones
- connectoids are assumed to provide access toplanitModeTypes
- 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)suppressLogging
- when true, suppress logging, otherwise do not- Returns:
- true when at least connectoids where created for one of the transfer zones identified
-
extractDirectedConnectoidsForStandAloneTransferZoneByPlanitLink
public void extractDirectedConnectoidsForStandAloneTransferZoneByPlanitLink(long osmWaitingAreaId, org.locationtech.jts.geom.Geometry waitingAreaGeometry, MacroscopicLink accessLink, TransferZone transferZone, PredefinedModeType planitAccessModeType, double maxAllowedStopToTransferZoneDistanceMeters, MacroscopicNetworkLayer networkLayer, boolean suppressLogging)
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 onplanitAccessModeType
- eligible mode type for the stationmaxAllowedStopToTransferZoneDistanceMeters
- the maximum allowed distance between stop and waiting area that we allownetworkLayer
- the modes relate tosuppressLogging
- when true suppress logging, false otherwise
-
getSettings
protected OsmPublicTransportReaderSettings getSettings()
Collect the pt settings- Returns:
- public transport settings
-
getReferenceNetwork
protected PlanitOsmNetwork getReferenceNetwork()
-
getNetworkToZoningData
protected OsmNetworkToZoningReaderData getNetworkToZoningData()
-
hasNetworkLayersWithActiveOsmNode
protected 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- Parameters:
osmNodeId
- to use- Returns:
- true when one or more layers are found, false otherwise
-
findOsmVerticalLayerIndexByStopPositionPlanitLinks
protected Pair<Integer,Boolean> findOsmVerticalLayerIndexByStopPositionPlanitLinks(org.locationtech.jts.geom.Point stopPositionLocation, NetworkLayer layer)
Based on the location of the stop position, determine if the PLANit links that it resides on, or borders or reside in a particular layer. If so, the OSM vertical layer index is retrieved and provided. If inconsistent indices are found across the links the user is warned, if no matching links are known on the layer null is returned.- Parameters:
stopPositionLocation
- to find layer index forlayer
- to check- Returns:
- OSM vertical layer index found, and boolean indicating if the found layer index was the same across all eligible links (true), false otherwise
-
-