Skip to content
This repository has been archived by the owner on Nov 26, 2021. It is now read-only.

TravelTimePredictionExample wrong GeoUtils usage for direction #32

Open
rucub100 opened this issue Sep 16, 2018 · 0 comments
Open

TravelTimePredictionExample wrong GeoUtils usage for direction #32

rucub100 opened this issue Sep 16, 2018 · 0 comments

Comments

@rucub100
Copy link

Hi,

i think i have found a small problem in the example.
This commit in my fork contains the fix.
The line

int direction = GeoUtils.getDirectionAngle(ride.endLon, ride.endLat, ride.startLon, ride.startLat);

should be

int direction = GeoUtils.getDirectionAngle(ride.startLon, ride.startLat, ride.endLon, ride.endLat);

because the GeoUtils API says

/**
	 * Returns the angle in degrees between the vector from the start to the destination
	 * and the x-axis on which the start is located.
	 *
	 * The angle describes in which direction the destination is located from the start, i.e.,
	 * 0° -> East, 90° -> South, 180° -> West, 270° -> North
	 *
	 * @param startLon longitude of start location
	 * @param startLat latitude of start location
	 * @param destLon longitude of destination
	 * @param destLat latitude of destination
	 * @return The direction from start to destination location
	 */
	public static int getDirectionAngle(
			float startLon, float startLat, float destLon, float destLat)

Or maybe I am wrong? Looking forward for feedback, thanks in advance.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant