Module:Ordnance Survey coordinates/sandbox: Difference between revisions

Content deleted Content added
oops logic backwards
default namearg to current page title
Line 432:
-- function to generate direct link to OS map
local function directLink(main_args, other_args, LL)
-- create link to Bing server offor OS maps. Example:
-- https://www.bing.com/maps/?mkt=en-gb&v=2&cp=56.796026%7E-5.01307&lvl=16.0&sp=Point.56.796029_-5.004711_Ben+Nevis&sty=s&style=s
local current_page = mw.title.getCurrentTitle()
local namearg = main_args["name"] and mw.uri.encode( main_args["name"] or current_page, 'QUERY' )
local args = {}
for _, a in ipairs(other_args) do
Line 444 ⟶ 445:
local lvl = zoom(args)
local url = mw.ustring.format('https://www.bing.com/maps/?mkt=en-gb&v=2&cp=%.6f%%7E%.6f&lvl=%d&sp=Point.%.6f_%.6f',LL.lat,LL.long,lvl,LL.lat,LL.long)
if not empty(namearg) then
url = url..'_'..namearg
end
url = url..'&sty=s&style=s'