Module:Austrianmap
Apparence
La documentation de ce module est générée par le modèle {{Documentation module}}.
Les éditeurs peuvent travailler dans le bac à sable (créer).
Voir les statistiques d'appel depuis le wikicode sur l'outil wstat et les appels depuis d'autres modules.
local Tools = require('Module:Outils')
local Coordinates = require('Module:Coordinates')
local wd = require("Module:Wikidata")
local url = {}
local function coord_converter(value)
if tonumber(value) then
return value
else
local dms_object = Coordinates._parsedmsstring(value)
return Coordinates._dms2dec(dms_object)
end
end
local function coord(args)
if args.latitude and args.longitude then
return args.latitude, args.longitude
else
latitude = wd.formatStatements{property = 'P625', numval = 1, displayformat=latitude}
longitude = wd.formatStatements{property = 'P625', numval = 1, displayformat=longitude}
return latitude, longitude
end
end
url.austrianmap = function (frame)
local args = Tools.extractArgs(frame)
local validArg = function ( ... ) return Tools.validTextArg( args, ... ) end
local latitude, longitude = coord(args)
local latitude = coord_converter(latitude)
local longitude = coord_converter(longitude)
local url = ''
local desc = args.desc or 'Visualisation'
local pi = 3.141592653589793
local e = 0.08181919132
local a = 6378137
local lat = latitude * pi / 180
local lon = longitude * pi / 180
local lat_1 = 49 * pi / 180
local lat_2 = 46 * pi / 180
local lat_0 = 47.5 * pi / 180
local lon_0 = 13.33333333 * pi / 180
local x_0 = 400000
local y_0 = 400000
local lon1 = lon - pi/5000
local lon2 = lon + pi/5000
local n_num = math.log(math.cos(lat_2)/math.cos(lat_1)) + 0.5*math.log((1-e^2*math.sin(lat_1)^2)/(1-e^2*math.sin(lat_2)^2))
local n_dem = math.log( math.tan(pi/4+lat_1/2)*(1-e*math.sin(lat_1))^(e/2)*(1+e*math.sin(lat_2))^(e/2) / (math.tan(pi/4+lat_2/2)*(1+e*math.sin(lat_1))^(e/2)*(1-e*math.sin(lat_2))^(e/2)) )
local n = n_num / n_dem
local init = a*math.cos(lat_1)/(n*math.sqrt(1-e^2*math.sin(lat_1)^2)) * ((math.tan(pi/4+lat_1/2))*((1-e*math.sin(lat_1))/(1+e*math.sin(lat_1)))^(e/2))^n
local rho = init * ((1/math.tan(pi/4+lat/2))*((1+e*math.sin(lat))/(1-e*math.sin(lat)))^(e/2))^n
local rho_0 = init * ((1/math.tan(pi/4+lat_0/2))*((1+e*math.sin(lat_0))/(1-e*math.sin(lat_0)))^(e/2))^n
local X = math.floor(x_0 + rho * math.sin(n * (lon - lon_0)))
local Y = math.floor(y_0 + rho_0 - rho * math.cos(n * (lon - lon_0)))
local X1 = math.floor(x_0 + rho * math.sin(n * (lon1 - lon_0)))
local Y1 = math.floor(y_0 + rho_0 - rho * math.cos(n * (lon1 - lon_0)))
local X2 = math.floor(x_0 + rho * math.sin(n * (lon2 - lon_0)))
local Y2 = math.floor(y_0 + rho_0 - rho * math.cos(n * (lon2 - lon_0)))
local header = '[http://www.austrianmap.at/amap/index.php?setTo=1~'
local url_coord = X1 .. '~' .. Y1 .. '~' .. X2 .. '~' .. Y2
url = url .. header .. url_coord .. ' ' .. desc ..'] sur [[Bundesamt für Eich- und Vermessungswesen|BEV]]'
if args['consulté le'] then
url = url .. ' <small>(consulté le' .. args['consulté le'] .. ')</small>'
end
return url
end
return url