Module:Sandbox/Jackmcbarn: Difference between revisions

Content deleted Content added
Jackmcbarn (talk | contribs)
test the projection
Jackmcbarn (talk | contribs)
m Reverted edits by Jackmcbarn (talk) to last version by Le Deluge
Tags: Replaced Rollback
 
(27 intermediate revisions by 2 users not shown)
Line 1:
local locmapgetTarget = require('Module:Location mapRedirect').getTarget
local p = {}
 
local function pagetype(nsText)
function p.lambertConformalConic(refLat, refLong, stdParallel1, stdParallel2)
return nsText == '' and 'articles' or (mw.ustring.lower(nsText) .. ' pages')
return function(latitude, longitude)
local n
if stdParallel1 == stdParallel2 then
n = math.sin(stdParallel1)
else
n = math.log(math.cos(stdParallel1)/math.cos(stdParallel2))/
math.log(math.tan(0.25*math.pi + 0.5*stdParallel2)/math.tan(0.25*math.pi + 0.5*stdParallel1))
end
local f = math.cos(stdParallel1)*math.tan(0.25*math.pi + 0.5*stdParallel1)^n/n
local rho = f*math.tan(0.25*math.pi + 0.5*latitude)^-n
local rho0 = f*math.tan(0.25*math.pi + 0.5*refLat)^-n
return {
x = rho*math.sin(n*(longitude - refLong)),
y = rho0 - rho*math.cos(n*(longitude - refLong))
}
end
end
 
function p.pairs(frame)
local args, args_mt = { '__pairs was not used' }, {}
function args_mt.__pairs( t )
return pairs( { 'success' } )
end
return frame:expandTemplate{ title = 'Echo', args = setmetatable( args, args_mt ) }
end
 
function p.main(frame)
local currentTitle = mw.title.getCurrentTitle()
local locmap = require('Module:Location map')
local retvaltarget = {}getTarget(currentTitle)
if target then
for long=-165,-30,15 do
local currentNsText, targetNsText = currentTitle.nsText, mw.title.new(target).nsText
for lat=40,90,5 do
if currentNsText ~= targetNsText then
retval[#retval + 1] = tostring(locmap.mark(frame, {'Canada', long=long, lat=lat, outside='1'}))
return string.format('[[:Category:Cross-namespace redirects from %s]][[:Category:Cross-namespace redirects to %s]]', pagetype(currentNsText), pagetype(targetNsText))
end
end
return '[[:Category:Pages incorrectly tagged as cross-namespace redirects]]'
return locmap.top(frame, {'Canada'}) .. table.concat(retval) .. locmap.bottom(frame, {'Canada'})
end