I have a gps module that gives me latitude in longitude in a weird format.
DDDMM.MMMM
As written on user manual, Degrees*100 + Minutes.
As far as I know, It is degrees minutes seconds, and seconds is between 0-59, above than this will increment the minute. But this is giving minutes in decimal places. Does this means 1/1000th of a minute?
eg. 07717.3644 E
077 --> degrees
17 --> minutes
3644 --> ?
E --> Direction
Also how will I convert it to decimal, I am using the formula
decimal = degrees + minutes/60 + seconds/3600.
To convert this to the decimal format, we start by keeping the DD portion and simply divide the MM. MMM by 60 to firm the MMM portion of the decimal format.
Here are examples of formats that work: Decimal degrees (DD): 41.40338, 2.17403. Degrees, minutes, and seconds (DMS): 41°24'12.2"N 2°10'26.5"E. Degrees and decimal minutes (DMM): 41 24.2028, 2 10.4418.
Introduction. Terrain Navigator Pro allows you to display and enter Latitude/Longitude coordinates in three formats: Degrees Minutes Seconds (D° M' S"), Decimal Minutes (D° M. M'), and Decimal Degrees (D.D°). Each of these formats can represent the same geographic location, but expressed differently.
To convert this to the decimal format, we start by keeping the DD portion and simply divide the MM.MMM by 60 to firm the MMM portion of the decimal format.
43. (48.225/60), -79.(59.074/60)
43.(0.80375), -79.(0.98456)
43.80375, -79.98456
In your case
eg. 07717.3644 E is the DDDMM.MMMM format
077 --> degrees
17 --> minutes
.3644 --> minutes equals to sec/60
decimal = degrees + minutes/60
decimal = 77 + (17.3644 / 60)
decimal = 77.28941
See this Link Would help you
Follow the algorithm to convert the same.
var t = "7523.7983" // (DDMM.MMMM)
var g = "03412.9873" //(DDDMM.MMMM)
function lat(t){
return (Number(t.slice(0,2)) + (Number(t.slice(2,9))/60))
}
function lng(g) {
return (Number(g.slice(0,3)) + (Number(g.slice(3,10))/60))
}
console.log(lat(t))
console.log(lng(g))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With