Module:Geonotice map
Helps admins visualize geonotices. See the output at Wikipedia:Geonotice/Map.
-- If the "country": "GB" feature is used instead of "corners", we need the Wikidata ID of the country for the map to use
local countries = {
GB = "Q145",
US = "Q30",
CA = "Q16",
MX = "Q96",
JM = "Q766",
TT = "Q754",
GY = "Q734",
GT = "Q774",
DO = "Q786",
BS = "Q778",
CR = "Q800",
BZ = "Q242",
PA = "Q804",
PH = "Q928",
SG = "Q334",
}
local p = {}
function p.main(frame)
local data = mw.loadJsonData("Wikipedia:Geonotice/list.json")
local geojson = {}
for name, info in pairs(data) do
local properties = {
title = name,
description = info.text .. "<br>(Start: " .. info.begin .. ", end: " .. info["end"] .. ")"
}
local feature
if info.country ~= nil then
feature = {
type = "ExternalData",
service = "geoshape",
ids = countries[info.country],
properties = properties
}
else
feature = {
type = "Feature",
properties = properties,
geometry = {
type = "Polygon",
-- note that GeoJSON is lon, lat while Geonotice is lat, lon. sigh.
coordinates = { {
{ info.corners[1][2], info.corners[1][1] },
{ info.corners[2][2], info.corners[1][1] },
{ info.corners[2][2], info.corners[2][1] },
{ info.corners[1][2], info.corners[2][1] },
{ info.corners[1][2], info.corners[1][1] }
} }
}
}
end
table.insert(geojson, feature)
end
local width = frame.args.width or "full"
local height = frame.args.height or "500"
return frame:extensionTag{
name = 'mapframe',
content = mw.text.jsonEncode(geojson),
args = {
width = width,
height = height,
text = "See a map of actively configured geonotices"
}
}
end
return p
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.