Module:Sandbox/Denelson83 Explained

local function grid_extents (frame) local series = tonumber(frame.args[1]) local area = (frame.args[2]) local sheet = tonumber(frame.args[3]) local belt local belt_area_south = local belt_area_north = local belt_sheet =

if series >= 120 then belt = 160 + series % 10 * 16 + belt_area_north[area] + belt_sheet[sheet] elseif series < 120 and series % 10 * 16 >= 112 then belt = series % 10 * 16 + belt_area_north[area] + belt_sheet[sheet] else belt = series % 10 * 16 + belt_area_south[area] + belt_sheet[sheet] end

local strip local strip_series_high_arctic =

local strip_area_southern = local strip_area_arctic = local strip_area_high_arctic =

local strip_sheet_southern = local strip_sheet_arctic = local strip_sheet_high_arctic =

local east_limit, west_limit; -- For 1:50,000 scale map sheet local area_east_limit, area_west_limit; -- For 1:250,000 scale map area

if series >= 120 then strip = strip_series_high_arctic[math.floor(series / 10)] + strip_area_high_arctic[area] + strip_sheet_high_arctic[sheet];

east_limit = strip * 0.5 + 48 west_limit = (strip + 4) * 0.5 + 48 area_east_limit = math.floor(strip / 16) * 8 + 48 area_west_limit = math.floor((strip + 16) / 16) * 8 + 48

elseif series < 120 and math.floor(series % 10) >= 7 then strip = math.floor(series / 10) * 16 + strip_area_arctic[area] + strip_sheet_arctic[sheet];

east_limit = strip * 0.5 + 48 west_limit = (strip + 2) * 0.5 + 48 area_east_limit = math.floor(strip / 8) * 4 + 48 area_west_limit = math.floor((strip + 8) / 8) * 4 + 48

else strip = math.floor(series / 10) * 16 + strip_area_southern[area] + strip_sheet_southern[sheet];

east_limit = strip * 0.5 + 48 west_limit = (strip + 1) * 0.5 + 48 area_east_limit = math.floor(strip / 4) * 2 + 48 area_west_limit = math.floor((strip + 4) / 4) * 2 + 48

end

local grid_limits = return "1:50,000 limits: " .. grid_limits["south"], "°N, " .. grid_limits["north"] .. "°N, " .. grid_limits["east"] .. "°W, " .. grid_limits["west"] .. "°W, " .. " - 1:250,000 limits: " .. grid_limits["area_south"] .. "°N, " .. grid_limits["area_north"] .. "°N, " .. grid_limits["area_east"], "°W, " .. grid_limits["area_west"], "°W"end

return