Changing GPS co-ordinates into Degrees-Minutes-Seconds


Closed Thread
Results 1 to 19 of 19

Hybrid View

  1. #1
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    I have some ugly code that I could share ... (if you really want it...)

    But the basic conversion is *5/300 for minutes and *5/18000 for seconds

    For instance 30 minutes *5/300 = .50 degrees


    if latitude = 47 deg 32 min 14 sec
    47 32' 14"

    then we can use:
    32 *500/3 = 5333 (really .5333 degrees)

    for seconds:
    14*50/18 = 38 (really .0038 degrees)

    Then add 5333 + 38 = 5371 or .5371 degrees

    So, 47.5371 degrees is the answer.
    http://www.scalerobotics.com

  2. #2


    Did you find this post helpful? Yes | No

    Question

    I am confused as well.
    Last edited by financecatalyst; - 26th October 2009 at 18:12.
    ___________________
    WHY things get boring when they work just fine?

  3. #3


    Did you find this post helpful? Yes | No

    Question

    Quote Originally Posted by scalerobotics View Post
    I have some ugly code that I could share ... (if you really want it...)

    But the basic conversion is *5/300 for minutes and *5/18000 for seconds

    For instance 30 minutes *5/300 = .50 degrees


    if latitude = 47 deg 32 min 14 sec
    47 32' 14"

    then we can use:
    32 *500/3 = 5333 (really .5333 degrees)

    for seconds:
    14*50/18 = 38 (really .0038 degrees)

    Then add 5333 + 38 = 5371 or .5371 degrees

    So, 47.5371 degrees is the answer.
    I would like to see the code if you dont mind. Currently the coordinates are in a string format. Being new to this field your code will help me to have a starting point and will help me understand and decide the way forward

  4. #4
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Sorry, let me explain a little more. I will try to explain this better tonight when I get home from work.

    The basic conversion is:
    Code:
    Converting Between Decimal Degrees, Degrees, Minutes and Seconds, and Radians
    (dd + mm/60 +ss/3600) to Decimal degrees (dd.ff)
    
    dd = whole degrees, mm = minutes, ss = seconds
    
    dd.ff = dd + mm/60 + ss/3600
    
    Example: 30 degrees 15 minutes 22 seconds = 30 + 15/60 + 22/3600 = 30.2561
    
    Decimal degrees (dd.ff) to (dd + mm/60 +ss/3600)
    But division by 3600 does not work so well for PICs, so .......

    Here are a couple ways of converting 15 minutes:
    15minutes/60 = .25 degrees. Unfortunately PicBasicPro will round it off to 0, which we do not like.

    So, if we change it to 15minutes*500/3=2500 (you'll notice this is the same as the first equation, only multiplied by 10000). We want whole numbers here, and we will need to add seconds to it in whole numbers too.


    Here is one part of my minutes to degrees conversion, but I will try to make this a lot clearer tonight. char_A is the validity character in a gps string called gpsdata.
    Code:
    lathome_min = ((((gpsdata[char_A+9]-48)*10) + (gpsdata[char_A+10]-48))*5)/3    'lathome_min
    http://www.scalerobotics.com

Similar Threads

  1. GPS $GPRMC to PIC16F684. Need help with SERIN2
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 27th November 2009, 09:47
  2. Virtual LED Clock For Windows By Trent Jackson
    By T.Jackson in forum Code Examples
    Replies: 8
    Last Post: - 10th November 2009, 08:20
  3. new and need help
    By smeghead in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd November 2008, 20:19
  4. GPS clock timing !
    By bethr in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 3rd July 2008, 20:11
  5. DS1994 Memory/Time iButton
    By NavMicroSystems in forum mel PIC BASIC Pro
    Replies: 47
    Last Post: - 22nd October 2006, 11:55

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts