Content deleted Content added
nope |
use tables as return values, not tuples |
||
Line 35:
local preview = require('Module:If preview')
local namespace = mw.title.getCurrentTitle().namespace;
local function northeast(lett,num,shift)
Line 41 ⟶ 40:
local le=mw.ustring.len(num)
if le%2 == 1 then
end
local pr=le/2
Line 67 ⟶ 66:
end
end
return
end
Line 150 ⟶ 149:
until abs(phinewwgs84-phiradwgs84)<=0.000000000001 or nextcounter>=100
lat=phinewwgs84*dr
return {country="GB"
end
Line 158 ⟶ 157:
-- first caclulate e,n
-- computing e and n exactly, to get SW corner of box
local
if ne.err
end
-- use British definition of e and n
local e=500000.0*(ne.T1%5)+100000.0*(ne.T2%5)-1000000.0+ne.e*ne.pr
local n=1900000.0-500000.0*math.floor(ne.T1/5)-100000.0*math.floor(ne.T2/5)+ne.n*ne.pr
result.prec = 0.8165*ne.pr
return result
end
Line 249 ⟶ 250:
until abs(phinewwgs84-phiradwgs84)<=0.000000000001 or nextcounter>=10000
lat=phinewwgs84*dr
return {country="IE"
end
Line 256 ⟶ 257:
-- first caclulate e,n
-- computing e and n exactly, to get SW corner of box
local
if ne.err
end
-- use Irish definition of northing and easting
local e=100000.0*(ne.T1%5.0)+ne.e*ne.pr
local n=ne.n*ne.pr+100000.0*(4.0-math.floor(ne.T1/5.0))
result.prec = 0.8165*ne.pr -- useful @ Commons
return result
end
Line 271 ⟶ 274:
local function NGR2LL(ngr)
local result = {}
ngr = mw.ustring.gsub(mw.ustring.upper(ngr),"[%s%p]","")
local first, last, lett, num = mw.ustring.find(ngr,"^([A-Z]+)(%d+)$")
if first == nil or empty(lett) or empty(num) or mw.ustring.len(lett) > 2 then
return
end
if mw.ustring.len(lett) == 1 then
Line 332 ⟶ 335:
local firstArg = mw.ustring.sub(args[1],2)
if alldigits(firstArg) then
LL =
restargs = 3
if empty(linktitle) then
Line 339 ⟶ 342:
end
elseif alldigits(args[1]) then
LL =
restargs = 3
if empty(linktitle) then
Line 346 ⟶ 349:
end
else
LL =
restargs = 2
if empty(linktitle) then
Line 353 ⟶ 356:
end
linktitle = trim(linktitle)
if not empty(LL
return linktitle ..warning(LL
end
-- https://geohack.toolforge.org/geohack.php?pagename=Mount_Whitney¶ms=36.578580925_N_118.29199495_W_type:mountain_region:US-CA_scale:100000_source:NGS
Line 365 ⟶ 368:
url = url..'pagename='..pagename..'&'
end
LL.lat = LL.lat or 0
url = url..'params='..LL[3]..'_N_'▼
if LL.long < 0 then
else
url = url..LL
end
for i = restargs,#args do
url = url..'_'..args[i]
end
if mw.ustring.find(input,"region") == nil and LL.country then
url = url..'_region:'..LL
end
if not empty(namearg) then
|