Pimentel
- 26th June 2009, 22:55
Hello,
I have a project using a GPS module in my car e now I want to improve it adding a new option... I want to know if I am near of some known poitns as radars of speeds of the roads then I thought about calculating in the distance between known LA/LON of the current LAT/LON and to test if this value is greater that one determined ray, for example 30 meters.
As I want I covered an area relatively small I I thought about transforming degree, minute and seconds of the coordinates format of my gps ('$GPRMC,151805.812,A,2241.6835,S,04700.3015,W,0.0 0,,131206,,*1F ) in degrees and then to find the difference using the theorem of pitagoras: square shaped root of x^2+y^2, where x is lat1-lat2 and y is long1-long2. I have all datas in arrays (Lat var byte[9]: Lon var byte[10]).
To convert I think it: GRAUs = GRAUS+(MIN/60)+((.mmmm*60)/3600). Finally I multiply the value in degrees of the difference of the 2 coordinates for the value of 111120 meters (ray of the planet in the Equator), to only have an approach value. I also can search the accurate value of a degree in my region!
Somebody can help with some algorithm to only decide this problem using word and byte variables?
Thanks
Pimentel
I have a project using a GPS module in my car e now I want to improve it adding a new option... I want to know if I am near of some known poitns as radars of speeds of the roads then I thought about calculating in the distance between known LA/LON of the current LAT/LON and to test if this value is greater that one determined ray, for example 30 meters.
As I want I covered an area relatively small I I thought about transforming degree, minute and seconds of the coordinates format of my gps ('$GPRMC,151805.812,A,2241.6835,S,04700.3015,W,0.0 0,,131206,,*1F ) in degrees and then to find the difference using the theorem of pitagoras: square shaped root of x^2+y^2, where x is lat1-lat2 and y is long1-long2. I have all datas in arrays (Lat var byte[9]: Lon var byte[10]).
To convert I think it: GRAUs = GRAUS+(MIN/60)+((.mmmm*60)/3600). Finally I multiply the value in degrees of the difference of the 2 coordinates for the value of 111120 meters (ray of the planet in the Equator), to only have an approach value. I also can search the accurate value of a degree in my region!
Somebody can help with some algorithm to only decide this problem using word and byte variables?
Thanks
Pimentel