Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decimal lat and lon ? #54

Closed
dbrb2 opened this issue Jun 11, 2016 · 2 comments
Closed

Decimal lat and lon ? #54

dbrb2 opened this issue Jun 11, 2016 · 2 comments

Comments

@dbrb2
Copy link

dbrb2 commented Jun 11, 2016

Hi,

I have installed this library via pip, but have a problem accessing decimal lat and lon....

The below:
msg = pynmea2.parse(rcv)

print msg.gps_qual
print rcv
print msg.lat+" "+msg.lon
print msg.latitude+" "+msg.longitude

Gives the following output:
1
$GPGGA,185953.00,5123.94863,N,00009.08705,W,1,08,1.18,47.3,M,45.6,M,,*7E
5131.94862 00008.08693

In other words the un-converted lat/lon is printed, but not the decimal version. Any idea why...?

@Knio
Copy link
Owner

Knio commented Jun 11, 2016

Hi,

This sentence seems to work fine for me. I don't see your last line of output there?

>>> r = pynmea2.parse('$GPGGA,185953.00,5123.94863,N,00009.08705,W,1,08,1.18,47.3,M,45.6,M,,')
>>> r.latitude
51.39914383333333
>>> r.longitude
-0.15145083333333334
>>> r.lat
'5123.94863'
>>> r.lon
'00009.08705'

@dbrb2
Copy link
Author

dbrb2 commented Jun 11, 2016

Ah - sorted - it was a case of "error in front of keyboard"

I was using:

print msg.latitude+" "+msg.longitude

To get my output - without explicitly casting the lat / lon to strings
beforehand. For some reason this didn't throw an error, but would explain
why I was getting no output!

All OK now - apologies, but thanks for trying to help so quickly!

On Sat, Jun 11, 2016 at 8:13 PM, Tom Flanagan notifications@github.com
wrote:

Hi,

This sentence seems to work fine for me. I don't see your last line of
output there?

r = pynmea2.parse('$GPGGA,185953.00,5123.94863,N,00009.08705,W,1,08,1.18,47.3,M,45.6,M,,')
r.latitude
51.39914383333333
r.longitude
-0.15145083333333334
r.lat
'5123.94863'
r.lon
'00009.08705'


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#54 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AAJYc2IwWLgEDUuOyJbVOo96qBbxLmp2ks5qKwjmgaJpZM4Iznqm
.

@Knio Knio closed this as completed Jun 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants