15.458
Bearbeitungen
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
| Zeile 17: | Zeile 17: | ||
function p.karte(frame, args) | function p.karte(frame, args) | ||
-- mw.log("karte(frame, args)") | |||
-- mw.logObject(args, "args") | |||
-- Konsolenzeilen zum Debuggen: | -- Konsolenzeilen zum Debuggen: | ||
-- =p.karte(mw.getCurrentFrame(), args) | -- =p.karte(mw.getCurrentFrame(), args) | ||
| Zeile 68: | Zeile 68: | ||
-- Prüfung Koordinate (Zahl) oder textuelle Objektlokation | -- Prüfung Koordinate (Zahl) oder textuelle Objektlokation | ||
-- wenn Objektlokation und Ehemals, dann nicht auswerten | -- wenn Objektlokation und Ehemals, dann nicht auswerten | ||
if string.match(location, "%d") == nil and -- Keine-Zahl-Erkennung | if string.match(location, "%d") == nil and -- Keine-Zahl-Erkennung. location kann auch Koordinate sein | ||
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 | ||
| Zeile 83: | Zeile 83: | ||
minimum_one_geocode_ok = true | minimum_one_geocode_ok = true | ||
else | else | ||
-- geocode nicht erfolgreich => SMW-DB nehmen | -- geocode nicht erfolgreich => SMW-DB-Eintrag nehmen | ||
kategorien["Hat Geo-Kodierungsfehler"] = true | kategorien["Hat Geo-Kodierungsfehler"] = true | ||
local smw_geokoordinate = mw.smw.ask( | local smw_geokoordinate = mw.smw.ask( | ||
| Zeile 135: | Zeile 135: | ||
setAttr(attrlist, "Zoomlevel", args["zoom"]) | setAttr(attrlist, "Zoomlevel", args["zoom"]) | ||
-- normale Attribute setzen | -- normale Attribute setzen | ||
-- mw.logObject(attrlist, "attrlist") | |||
mw.smw.set(attrlist) | mw.smw.set(attrlist) | ||
-- geoobjects als subobjects setzen | -- geoobjects als subobjects setzen | ||
-- mw.logObject(geoobjects, "geoobjects") | |||
for _, o in ipairs(geoobjects) do | for _, o in ipairs(geoobjects) do | ||
o["SubObjektTyp"] = "Geo" | o["SubObjektTyp"] = "Geo" | ||
| Zeile 150: | Zeile 150: | ||
["width"] = args["width"], ["height"] = args["height"], | ["width"] = args["width"], ["height"] = args["height"], | ||
["enablefullscreen"] = "yes", ["resizable"] = "yes"} | ["enablefullscreen"] = "yes", ["resizable"] = "yes"} | ||
-- geojson- | -- geojson-Argument | ||
if wik.pageExists(geojson_fullpagename) then | if wik.pageExists(geojson_fullpagename) then | ||
map_args["geojson"] = geojson_pagename | map_args["geojson"] = geojson_pagename | ||
| Zeile 158: | Zeile 158: | ||
end | end | ||
-- location/lat/lon-Argumente | -- location/lat/lon-Argumente | ||
if not (wik.pageExists(geojson_fullpagename) and -- Pin-Anzeige deaktivieren, wenn GeoJson vorhanden | if not (wik.pageExists(geojson_fullpagename) and -- Pin-Anzeige deaktivieren, wenn GeoJson vorhanden und hide_loc_latlon=Ja | ||
com.isTrue(args["hide_loc_latlon"])) then -- SMW-DB wird trotzdem geschrieben | com.isTrue(args["hide_loc_latlon"])) then -- SMW-DB wird trotzdem geschrieben | ||
for _, o in ipairs(geoobjects) do | for _, o in ipairs(geoobjects) do | ||
| Zeile 178: | Zeile 178: | ||
-- Karte (display_map) | -- 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") | |||
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 | if args["geojson"] ~= nil and map_args["geojson"] == nil then | ||
| Zeile 202: | Zeile 202: | ||
kategorien["Hat Karte"] = true | kategorien["Hat Karte"] = true | ||
-- Check "Hat Geolokation, aber keine Geokoordinate" | -- Check "Hat Geolokation, aber keine Geokoordinate" | ||
for _, o in ipairs(geoobjects) do | for _, o in ipairs(geoobjects) do | ||
if o["Geolokation"] ~= nil and o["Geokoordinate"] == nil then | if o["Geolokation"] ~= nil and o["Geokoordinate"] == nil then | ||
kategorien["Hat Geolokation, aber keine Geokoordinate"] = true | kategorien["Hat Geolokation, aber keine Geokoordinate"] = true | ||
end | end | ||
end | end | ||
-- nun setzen | -- Kategorien nun setzen | ||
for k, _ in pairs(kategorien) do | for k, _ in pairs(kategorien) do | ||
t = t .. "[[Kategorie:" .. k .. "]]" | t = t .. "[[Kategorie:" .. k .. "]]" | ||