Vai al contenuto

Modulo:Layers

Da Wikivoyage.

Vedi Template:Layers.


local p = {}
local getArgs = require('Module:Arguments').getArgs

function p.Filter(frame)
	local args = getArgs(frame)
	local layers = args[1] or ''
	local filteredLayers = 'W' -- Wikivoyage (i.e. OpenStreetMap) layer is the default one.
	--filteredLayers = extract(layers,'M') --Working alternatives: M (Mapnik) & R (Relief). Remove comment in case of temporary W server issue
	-- Add additional & acceptable layer parameters
	filteredLayers = filteredLayers
		.. extract(layers,'G') -- GPX file from Wikivoyage
		.. extract(layers,'P') -- POI from Wikivoyage NOT displayed
		.. extract(layers,'E') -- add search box inside the map
		.. extract(layers,'D') -- destination from Wikivoyage
--[[ Disabling parameters that share user info (e.g. IP) with third parties
		.. extract(layers,'S') -- hill shading from WM server
		.. extract(layers,'H') -- hiking
		.. extract(layers,'C') -- cycling
		.. extract(layers,'B') -- border
		.. extract(layers,'N') -- traffic network
		]]
	return filteredLayers
end

function extract(layers, layer)
	if string.match(layers, layer) ~= nil then
		return string.match(layers, layer)
	else
		return ''
	end
end

return p