Package org.goplanit.gtfs.util
Class GtfsTransferZoneHelper
- java.lang.Object
-
- org.goplanit.gtfs.util.GtfsTransferZoneHelper
-
public class GtfsTransferZoneHelper extends Object
Utils class related to GTFS and PLANit transfer zone functionality- Author:
- markr
-
-
Constructor Summary
Constructors Constructor Description GtfsTransferZoneHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TransferZone
createAndRegisterNewTransferZone(GtfsStop gtfsStop, org.locationtech.jts.geom.Point projectedGtfsStopLocation, TransferZoneType type, GtfsZoningHandlerData data)
Helper method to create and register a new transfer zone based on a GTFS stopstatic Collection<TransferZone>
findNearbyTransferZones(org.locationtech.jts.geom.Point location, double pointSearchRadiusMeters, GtfsZoningHandlerData data)
Find nearby zones based on a given search radiusstatic Pair<TransferZone,Double>
findTransferZoneStopLocationClosestTo(org.locationtech.jts.geom.Coordinate gtfsStopLocation, Collection<TransferZone> nearbyTransferZones, GtfsZoningHandlerData data)
find the transfer zone (underlying stop locations if any) closest to the provided GTFS stop location.static String
getLastTransferZoneExternalId(TransferZone transferZone)
extract last entry from Transfer zone external id based on comma separationstatic boolean
isGtfsStopOnCorrectSideOfTransferZoneAccessLinkSegments(GtfsStop gtfsStop, Mode gtfsMode, TransferZone transferZone, GtfsZoningHandlerData data, boolean allConnectoidsMustMatch)
Verify based on driving direction and orientation of the access link segment(s) whether the GTFS stop is a viable match for the found transfer zone in terms of being on the correct side of the road.
-
-
-
Method Detail
-
createAndRegisterNewTransferZone
public static TransferZone createAndRegisterNewTransferZone(GtfsStop gtfsStop, org.locationtech.jts.geom.Point projectedGtfsStopLocation, TransferZoneType type, GtfsZoningHandlerData data)
Helper method to create and register a new transfer zone based on a GTFS stop- Parameters:
gtfsStop
- to useprojectedGtfsStopLocation
- projected location to usetype
- type of transfer zonedata
- containing state- Returns:
- created and registered transfer zone
-
getLastTransferZoneExternalId
public static String getLastTransferZoneExternalId(TransferZone transferZone)
extract last entry from Transfer zone external id based on comma separation- Parameters:
transferZone
- to use- Returns:
- last entry or empty string
-
isGtfsStopOnCorrectSideOfTransferZoneAccessLinkSegments
public static boolean isGtfsStopOnCorrectSideOfTransferZoneAccessLinkSegments(GtfsStop gtfsStop, Mode gtfsMode, TransferZone transferZone, GtfsZoningHandlerData data, boolean allConnectoidsMustMatch)
Verify based on driving direction and orientation of the access link segment(s) whether the GTFS stop is a viable match for the found transfer zone in terms of being on the correct side of the road. The assumption here is that this pertains to a road based stop not rail and connectoids being available for the provided transfer zone to extract this information- Parameters:
gtfsStop
- to verifygtfsMode
- usedtransferZone
- to verify againstdata
- containing stateallConnectoidsMustMatch
- flag indicating whether we require all connectoids to be on the correct side of the road (true), or not (false)- Returns:
- true when on correct side of the road, false otherwise
-
findTransferZoneStopLocationClosestTo
public static Pair<TransferZone,Double> findTransferZoneStopLocationClosestTo(org.locationtech.jts.geom.Coordinate gtfsStopLocation, Collection<TransferZone> nearbyTransferZones, GtfsZoningHandlerData data)
find the transfer zone (underlying stop locations if any) closest to the provided GTFS stop location. In case the transfer zone has no stop locations registered, we use its overall geometry to match the distance to the GTFS stop location.- Parameters:
gtfsStopLocation
- to find closest transfer zone fornearbyTransferZones
- to considerdata
- containing state- Returns:
- found closest transfer zone
-
findNearbyTransferZones
public static Collection<TransferZone> findNearbyTransferZones(org.locationtech.jts.geom.Point location, double pointSearchRadiusMeters, GtfsZoningHandlerData data)
Find nearby zones based on a given search radius- Parameters:
location
- point location to search around (in WGS84 CRS)pointSearchRadiusMeters
- search radius to applydata
- containing state- Returns:
- found transfer zones around this location (in network CRS)
-
-