KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to write something that will determine the distance between to sets of lat/lon coordinates. I am using the following code which I found on this site : public static double distance (double lat1, double lon1, double lat2, double lon2) { double lat1 = Convert.ToDouble(latitude); double lon1 = Convert.ToDouble(longitude); double lat2 = Convert.ToDouble(destlat); double lon2 = Convert.ToDouble(destlon); double theta = toRadians(lon1-lon2); lat1 = toRadians(lat1); lon1 = toRadians(lon1); lat2 = toRadians(lat2); lon2 = toRadians(lon2); double dist = sin(lat1)*sin(lat2) + cos(lat1)*cos(lat2)*cos(theta); dist = toDegrees(acos(dist)) * 60 * 1.1515 * 1.609344 * 1000; return dist; } My problem is that I am running into the compile error "The name 'toRadians'/'cos'/'sin/'toDegrees' does not exist in the current context..." What am I doing wrong?
Tags (comma-separated)
Save Edits
Cancel