Content deleted Content added
fix the decmal display |
use precision to cap the digits displayed |
||
Line 563:
if form ~= "dec" then form = "dms" end
local lat, long, prec = datavalue.latitude, datavalue.longitude, datavalue.precision
local ns = "N"
Line 581:
local latdeg = math.floor(lat)
local latms = (lat - latdeg) * 60
if prec > 0.5 then
if latms > 30 then latdeg = latdeg + 1 end
latms = 0
end
local latmin = math.floor(latms)
local latsec = (latms - latmin) * 60
if prec > 0.008 then
if latsec > 30 then latmin = latmin +1 end
latsec = 0
end
if prec > 0.00014 then latsec = math.floor(latsec + 0.5) end
if prec > 0.000014 then latsec = math.floor(10 * latsec + 0.5) / 10 end
if prec > 0.0000014 then
latsec = math.floor(100 * latsec + 0.5) / 100
else -- cap it at 3 dec places for now
latsec = math.floor(1000 * latsec + 0.5) / 1000
end
local longdeg = math.floor(long)
local longms = (long - longdeg) * 60
if prec > 0.5 then
if longms > 30 then longdeg = longdeg + 1 end
longms = 0
end
local longmin = math.floor(longms)
local longsec = (longms - longmin) * 60
if prec > 0.008 then
if longsec > 30 then longmin = longmin +1 end
longsec = 0
end
if prec > 0.00014 then longsec = math.floor(longsec + 0.5) end
if prec > 0.000014 then longsec = math.floor(10 * longsec + 0.5) / 10 end
if prec > 0.0000014 then
longsec = math.floor(100 * longsec + 0.5) / 100
else -- cap it at 3 dec places for now
longsec = math.floor(1000 * longsec + 0.5) / 1000
end
if latsec == 0 and longsec == 0 then
|