Module:az-dialects/map

local p = {}

-- For cy (Latitude to SVG y-axis conversion) local lat_to_cy_slope = -168.26169 local lat_to_cy_intercept = 7139.742 - 38

-- For cx (Longitude to SVG x-axis conversion) local long_to_cx_slope = 128.57334 local long_to_cx_intercept = -5545.179 - 32

local function lat_to_cy(lat) return lat_to_cy_slope * lat + lat_to_cy_intercept end

local function long_to_cx(long) return long_to_cx_slope * long + long_to_cx_intercept end

function p.calculatePosition(frame) local lat = tonumber(frame.args.lat) local long = tonumber(frame.args.long) -- Safety checks in case lat or long aren't provided or aren't numbers if not lat then return "Error: Latitude not provided!" end

if not long then return "Error: Longitude not provided!" end local cy = lat_to_cy(lat) local cx = long_to_cx(long)

local color = frame.args.color or "red" -- default to red if no color provided return string.format('  ', cy, cx, color) end

return p