15.457
Bearbeitungen
(location/locationlist von Vorlage:Karte hierher verschoben) |
(Fehlermeldungen von Vorlage:Karte hierher portiert) |
||
| Zeile 9: | Zeile 9: | ||
function p.Karte(frame) | function p.Karte(frame) | ||
-- nur die benötigten Argumente übernehmen | -- nur die benötigten Argumente übernehmen | ||
local args = { | local args = {"lat", "lon", "location", "locationlist", "geojson", "zoom", | ||
"popuptitle", "popuptext", "box", "headline", "width", "height", | |||
"noattr", "Work"} | |||
"noattr", | |||
local args = wik.getArgs(frame.args, args) | local args = wik.getArgs(frame.args, args) | ||
return p.karte(frame, args) | return p.karte(frame, args) | ||
| Zeile 34: | Zeile 31: | ||
args["box"] = args["box"] or "Ja" | args["box"] = args["box"] or "Ja" | ||
args["zoom"] = args["zoom"] or "16" | args["zoom"] = args["zoom"] or "16" | ||
args["form"] = args["form"] or "nein" | |||
-- geojson-Angabe auswerten | |||
local geojson_pagename = args["geojson"] or pagename | local geojson_pagename = args["geojson"] or pagename | ||
local geojson_fullpagename = "GeoJson:" .. geojson_pagename | local geojson_fullpagename = "GeoJson:" .. geojson_pagename | ||
local geojson_url = "{{canonicalurl:" .. geojson_fullpagename .. "}}" | |||
-- width/height | -- width/height | ||
| Zeile 71: | Zeile 72: | ||
com.isTrue(args["Ehemals"]) then | com.isTrue(args["Ehemals"]) then | ||
kategorien["Hat Objektlokation, ist aber ehemaliges Objekt"] = true | kategorien["Hat Objektlokation, ist aber ehemaliges Objekt"] = true | ||
elseif args["lat"] == nil or args["lon"] == nil then -- to do: dieses if später rausschmeißen nach Aufbau nominatim.fuerthwiki.de | |||
geocode = getGeocode(frame, location) | |||
if geocode ~= "Geocoding failed" then | if geocode ~= "Geocoding failed" then | ||
geoobject_entry["Geokoordinate"] = geocode | geoobject_entry["Geokoordinate"] = geocode | ||
| Zeile 97: | Zeile 94: | ||
end -- if geocode ~= "Geocoding failed" then | end -- if geocode ~= "Geocoding failed" then | ||
end -- if Zahlerkennung | end -- if Zahlerkennung | ||
geoobject_entry["KartePopupTitle"] = popuptitle | |||
geoobject_entry["KartePopupText"] = popuptext | |||
table.insert(geoobjects, geoobject_entry) | table.insert(geoobjects, geoobject_entry) | ||
end -- if location ~= "" then | end -- if location ~= "" then | ||
| Zeile 104: | Zeile 102: | ||
-- geocode lon/lat, nur wenn location/locationlist nicht erfolgreich oder ehemals | -- geocode lon/lat, nur wenn location/locationlist nicht erfolgreich oder ehemals | ||
if (not minimum_one_geocode_ok or com.isTrue(args["Ehemals"])) and | if (not minimum_one_geocode_ok or com.isTrue(args["Ehemals"])) and | ||
args["lat"] ~= nil and args["lon"] ~= nil then | |||
local geoobject_entry = {} | local geoobject_entry = {} | ||
-- local geocode = getGeocode(frame, args["lat"] .. "," .. args["lon"]) | -- local geocode = getGeocode(frame, args["lat"] .. "," .. args["lon"]) | ||
| Zeile 114: | Zeile 112: | ||
kategorien["Hat Geo-Kodierungsfehler"] = true | kategorien["Hat Geo-Kodierungsfehler"] = true | ||
end | end | ||
geoobject_entry["KartePopupTitle"] = popuptitle | |||
geoobject_entry["KartePopupText"] = popuptext | |||
table.insert(geoobjects, geoobject_entry) | table.insert(geoobjects, geoobject_entry) | ||
end | end | ||
| Zeile 143: | Zeile 142: | ||
end | end | ||
-- | -- Karten-Argumente (display_map) erstellen | ||
local map_args = { "", ["zoom"] = args["zoom"], -- gemeinsame settings | local map_args = { "", ["zoom"] = args["zoom"], -- gemeinsame settings | ||
["width"] = args["width"], ["height"] = args["height"], | ["width"] = args["width"], ["height"] = args["height"], | ||
| Zeile 171: | Zeile 170: | ||
end | end | ||
end | end | ||
-- Karte (display_map) | |||
if map_args[1] ~= "" or map_args["geojson"] ~= nil then | if map_args[1] ~= "" or map_args["geojson"] ~= nil then | ||
mw.logObject(map_args, "map_args") | mw.logObject(map_args, "map_args") | ||
t = t .. frame:callParserFunction("#display_map", map_args) | t = t .. frame:callParserFunction("#display_map", map_args) | ||
if args["geojson"] ~= nil and map_args["geojson"] == nil then | |||
t = t .. "<small>Karte [" .. geojson_url .. " " .. args["geojson"] .. "] nicht gefunden</small>" | |||
end | |||
else | else | ||
if com.isTrue(args["form"]) then | |||
t = t .. "Positionsangabe fehlt oder fehlende Karte<br>" .. geojson_fullpagename .. "<br>Bitte Position in Formular eintragen oder" | |||
if com.isTrue(args[" | else | ||
t = t .. "Breiten-/Längengrad (lat/lon) fehlt, Objekt-Lokation (location) fehlt oder fehlende Karte<br>" .. geojson_fullpagename | |||
end | end | ||
t = t .. "<br>[" .. geojson_url .. " Hier klicken zum Anlegen der Karte<br>" .. geojson_fullpagename .. "].<br>Siehe auch [[Hilfe:Karten]]" | |||
kategorien["Ohne Position"] = true | |||
end | end | ||
-- Box | -- Box um Karte | ||
if com.isTrue(args["box"]) then | if com.isTrue(args["box"]) then | ||
local headline = args["headline"] or args["geojson"] or pagename | local headline = args["headline"] or args["geojson"] or pagename | ||
| Zeile 212: | Zeile 215: | ||
return frame:callParserFunction( | return frame:callParserFunction( | ||
"#geocode", {location, format="float", directional="no"}) | "#geocode", {location, format="float", directional="no"}) | ||
end | end | ||