Module:German coord convert
Appearance
local p = {}
function p.main(frame)
local c = frame.args[1] or ''
if mw.ustring.match(c, '^[%s]*([0-9][0-9]*)[%s]*/[%s]*([0-9][0-9]*)[%s]*/[%s]*([0-9][0-9%.]*)[%s]*/[%s]*[NEO][%s]*$') then
local d, m, s = mw.ustring.match(c, '^[%s]*([0-9][0-9]*)[%s]*/[%s]*([0-9][0-9]*)[%s]*/[%s]*([0-9][0-9%.]*)[%s]*/[%s]*[NEO][%s]*$')
return math.floor(1000000*(tonumber(d) + tonumber(m)/60 + tonumber(s)/3600) + 0.5)/1000000
end
if mw.ustring.match(c, '^[%s]*([0-9][0-9]*)[%s]*/[%s]*([0-9][0-9]*)[%s]*/[%s]*([0-9][0-9%.]*)[%s]*/[%s]*[SW][%s]*$') then
local d, m, s = mw.ustring.match(c, '^[%s]*([0-9][0-9]*)[%s]*/[%s]*([0-9][0-9]*)[%s]*/[%s]*([0-9][0-9%.]*)[%s]*/[%s]*[SW][%s]*$')
return -1*math.floor(1000000*(tonumber(d) + tonumber(m)/60 + tonumber(s)/3600) + 0.5)/1000000
end
return c
end
return p