Skip to content

Member function distanceBetween() is giving incorrect distance for negative latitude (US has negative longitude) #153

Description

@1-prop-head

It appears that when distanceBetween() is invoked with the following example values
lat1 = 39.55
lon1 = -83.99
lat2 = 39.55
lon2 = -83.99
distanceBetween( lat1, lon1, lat2, lon2)

does not return a very small distance as expected
When setting at the home location the following is returned
14:58:25.762 -> distanceBetween( 39.55, -83.99, 39.54, -83.99 )
14:58:25.762 -> Distance to home:
14:58:25.762 -> 1349.02

// Calculate the distance from the current location to "home"
double distanceToHome = gps.distanceBetween(latitude, longitude, hLatitude, hLongitude);
Serial.printf("distanceBetween( %s, %s, %s, %s )\n",String(latitude,2).c_str(), String(longitude,2).c_str(), String(homeLat,2).c_str(), String(homeLng,2).c_str());
Serial.println("Distance to home:");
Serial.println(distanceToHome);
where all values are doubles

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions