I am trying to write up a code using the known GPS position to caluate the distance to a given point>
long distance = dist2Point(long latitudeOfPoint,long longitudeOfPoint)
and also distance to a given line which goes between to GPS points>
long distance2Line = dist2Point(long latitudeOfPointStart,long longitudeOfPointStart, long latitudeOfPointEnd,long longitudeOfPointEnd)
any ideas how to do this by using snippets of existing code?
Thanks for all ideas
long get_distance(struct Location *loc1, struct Location *loc2)
if(loc1->lat == 0 || loc1->lng == 0)
if(loc2->lat == 0 || loc2->lng == 0)
float dlat = (float)(loc2->lat - loc1->lat);
float dlong = ((float)(loc2->lng - loc1->lng)) * scaleLongDown;
return sqrt(sq(dlat) + sq(dlong)) * .01113195;
taken from navigation.pde
So its just to multiple it with * .01113195; to get meter? Great. so that is it?