CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug Reports on this forum. Send them to support@ccsinfo.com

calculating distance from gps coordinates

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
championx



Joined: 28 Feb 2006
Posts: 131

View user's profile Send private message

calculating distance from gps coordinates
PostPosted: Thu Nov 16, 2017 6:13 pm     Reply with quote

Hi! do anyone have calculated distance using GPS coordinates?

It uses some complex math functions, do you have any advice to do this?

thanks
temtronic



Joined: 01 Jul 2010
Posts: 6327
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Nov 16, 2017 7:06 pm     Reply with quote

use integers
do NOT use floating point
search the forum
newguy



Joined: 24 Jun 2004
Posts: 1525
Location: Edmonton, Alberta

View user's profile Send private message

PostPosted: Thu Nov 16, 2017 7:12 pm     Reply with quote

https://en.wikipedia.org/wiki/Haversine_formula

Definitely use integers. If you're attempting this in a PIC, your accuracy (gut feeling only) isn't going to be on the order of meters or better. What sort of accuracy do you require?
Ttelmah



Joined: 11 Mar 2010
Posts: 13761

View user's profile Send private message

PostPosted: Fri Nov 17, 2017 2:35 am     Reply with quote

<http://www.ccsinfo.com/forum/viewtopic.php?t=27879&highlight=haversine>

<http://www.ccsinfo.com/forum/viewtopic.php?t=27947&highlight=cordic>

<http://www.ccsinfo.com/forum/viewtopic.php?t=47980&highlight=haversine>

The cordic code _with some added care to handle the quadrants and special cases_, can give great results.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group