Particle and GPS NEO-6M Latitude and Longitude values

I am using Particle device and neo-6m GPS which does give me values for both longitude and lattitude. However, the values appear to be too high and different from ones that are accepted by google. I’m thinking they might need to be converted in some way?

The values that are output are;

Latitude: 5555.8287
Longitude: 302.4025

The values accepted by google and what they should be close to are

Latitude: 55.53
Longitude: 302

I understand this isn’t specifically a Particle Argon issue but i was hoping someone may have came across this and can guide me. I think by the looks of these figures they need some kind of conversion?

Many thanks

Paul

You didn’t mention which library you are using for the GPS. It looks like it’s passing the direct value from the GNSS NEMA messages.

29.1.5 Latitude and Longitude Format

According to the NMEA Standard, Latitude and Longitude are output in the format Degrees, Minutes and (Decimal) Fractions of Minutes. To convert to Degrees and Fractions of Degrees, or Degrees, Minutes, Seconds and Fractions of seconds, the ‘Minutes’ and ‘Fractional Minutes’ parts need to be converted. In other words: If the GPS Receiver reports a Latitude of 4717.112671 North and Longitude of 00833.914843 East, this is

Latitude 47 Degrees, 17.112671 Minutes
Longitude 8 Degrees, 33.914843 Minutes

or

Latitude 47 Degrees, 17 Minutes, 6.76026 Seconds
Longitude 8 Degrees, 33 Minutes, 54.89058 Seconds

or

Latitude 47.28521118 Degrees
Longitude 8.56524738 Degrees

In other words, the raw output from the GNSS is degrees and minutes in the whole part and fractional minutes in the decimal part, so if you want degrees and fractional degrees you’ll need to convert it as above.

Thank you so much! That makes sense and just found a converter online
which gives me the results!

Will there be a function within particle or a library that might be able to do this in my filmware?

I meant to add the library i am currently using is

Particle-GPS.h

Would anyone know how i can convert NMEA to Decimal?

Latitude: 5555.8287
Longitude: 302.4025

Say these are stored in variables:

latitude = 4717.112671
longitude = 00833.914843

I want to convert these to dd format

Latitude 47.28521118 Degrees
Longitude 8.56524738 Degrees

so to update my variables to;

latitude = 47.28521118
longitude = 8.56524738

Thanks

@paul41, to be honest I’m not sure why you don’t use the TinyGPS++ library which does all that parsing and conversions for you. The Particle-GPS library makes extensive use of Strings which are known to create heap fragmentation problems.

2 Likes

The discussion has moved on to this thread by now

1 Like

The TinyGPS++ libary is not supported by the Particle device as i had tried this option prior.

You mean this library hosted in the Particle library repo?
https://build.particle.io/libs/TinyGPS++/0.9.4/tab/TinyGPS++.cpp

It’s also widely used as part of the AssetTrackerRK library (which also sports a UbloxGPS “sub-library”)
https://build.particle.io/libs/AssetTrackerRK/0.4.1/tab/AssetTrackerRK.cpp

1 Like