/// <summary> /// Returns the position of the lat/lon in the routerpoint relative to the edge. /// </summary> /// <returns>Returns left or right.</returns> public static RelativeDirectionEnum Direction(this RouterPoint routerPoint, RouterDb routerDb) { Line segment; var pointOnNetwork = routerPoint.LocationOnNetwork(routerDb, out segment); var direction = Itinero.Navigation.Directions.DirectionCalculator.Calculate( segment.Coordinate1, pointOnNetwork, routerPoint.Location()); switch (direction.Direction) { case RelativeDirectionEnum.Left: case RelativeDirectionEnum.SharpLeft: case RelativeDirectionEnum.SlightlyLeft: return(RelativeDirectionEnum.Left); case RelativeDirectionEnum.Right: case RelativeDirectionEnum.SharpRight: case RelativeDirectionEnum.SlightlyRight: return(RelativeDirectionEnum.Right); } Itinero.Logging.Logger.Log("Extensions", Itinero.Logging.TraceEventType.Warning, "Cannot determine left or right for routerpoint {1}: {0} was found, taking Left as default.", direction.Direction, routerPoint.ToInvariantString()); return(RelativeDirectionEnum.Left); }