local p =
local Mapframe = require('Module:Mapframe')
-- This function was imported from, should probably be "required" insteadfunction parseCoords(coords) local parts = mw.text.split((mw.ustring.match(coords,'[_%.%d]+[NS][_%.%d]+[EW]') or ), '_')
local lat_d = tonumber(parts[1]) local lat_m = tonumber(parts[2]) -- nil if coords are in decimal format local lat_s = lat_m and tonumber(parts[3]) -- nil if coords are either in decimal format or degrees and minutes only local lat = lat_d + (lat_m or 0)/60 + (lat_s or 0)/3600 if parts[#parts/2]
local long_d = tonumber(parts[1+#parts/2]) local long_m = tonumber(parts[2+#parts/2]) -- nil if coords are in decimal format local long_s = long_m and tonumber(parts[3+#parts/2]) -- nil if coords are either in decimal format or degrees and minutes only local long = long_d + (long_m or 0)/60 + (long_s or 0)/3600 if parts[#parts]
return lat, longend
-- Entry point for templatesfunction p.main(frame) local parent = frame.getParent(frame) local output = p._main(parent.args) return frame:preprocess(output)end
-- Entry point for modulesfunction p._main(_args) local targs = local pins = local del = _args['delimiter'] or '<>' local post_title_offset = _args['has_jurisdiction_metadata'] and 1 or 0 local jurisdiction_filter = _args['jurisdiction_filter'] for k,v in pairs(_args) do if k then k = tostring(k) if k:match('^%s*%d+%s*$') then local vals = mw.text.split(v, '%s*' .. del .. '%s*') local title = vals[1 ] or local coord = vals[2 + post_title_offset] or local mtype = vals[3 + post_title_offset] or _args['type'] or 'point' local markr = vals[4 + post_title_offset] or _args['marker'] or local msize = vals[5 + post_title_offset] or _args['marker-size'] or local mcolr = vals[6 + post_title_offset] or _args['marker-color'] or local lat,lon = parseCoords(coord) lat,lon = tonumber(lat),tonumber(lon) if jurisdiction_filter then local jurisdiction = vals[2] if mw.ustring.match(jurisdiction, jurisdiction_filter, 1) then table.insert(pins,) end else table.insert(pins,) end elseif k
'type' or k
'marker-size' or k
b[1] and a[2] < b[2]) end) for k,v in ipairs(pins) do if k
return p