Modul:Karte: Unterschied zwischen den Versionen

152 Bytes hinzugefügt ,  Gestern um 10:10
+ geoobjects.geojson, -getGeocode(frame, location), dms geocode
Keine Bearbeitungszusammenfassung
(+ geoobjects.geojson, -getGeocode(frame, location), dms geocode)
Zeile 34: Zeile 34:


-- geojson-Angabe auswerten
-- geojson-Angabe auswerten
local geojson_pagename = args["geojson"] or pagename
geoobjects.geojson = {}
local geojson_fullpagename = "GeoJson:" .. geojson_pagename
geoobjects.geojson.arg = args["geojson"]
local geojson_url = "{{canonicalurl:" .. geojson_fullpagename .. "}}"
geoobjects.geojson.pagename = geoobjects.geojson.arg or pagename
geoobjects.geojson.fullpagename = "GeoJson:" .. geoobjects.geojson.pagename
geoobjects.geojson.url = "{{canonicalurl:" .. geoobjects.geojson.fullpagename .. "}}"
geoobjects.geojson.exists = wik.pageExists(geoobjects.geojson.fullpagename)


-- width/height
-- width/height
Zeile 75: Zeile 78:
local geocode
local geocode
if args["lat"] == nil or args["lon"] == nil then -- to do: dieses if später rausschmeißen nach Aufbau nominatim.fuerthwiki.de
if 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) -- to do: behalten (mit local)
geocode = frame:callParserFunction("#geocode", location) -- to do: behalten (mit local)
else -- to do: dieses if später rausschmeißen nach Aufbau nominatim.fuerthwiki.de
else -- to do: dieses if später rausschmeißen nach Aufbau nominatim.fuerthwiki.de
geocode = args["lat"] .. "," .. args["lon"] -- to do: dieses if später rausschmeißen nach Aufbau nominatim.fuerthwiki.de
geocode = args["lat"] .. "," .. args["lon"] -- to do: dieses if später rausschmeißen nach Aufbau nominatim.fuerthwiki.de
Zeile 109: Zeile 112:
  args["lat"] ~= nil and args["lon"] ~= nil then
  args["lat"] ~= nil and args["lon"] ~= nil then
local geoobject_entry = {}
local geoobject_entry = {}
-- local geocode = getGeocode(frame, args["lat"] .. "," .. args["lon"])
-- local geocode = frame:callParserFunction("#geocode", args["lat"] .. "," .. args["lon"])
local geocode = args["lat"] .. "," .. args["lon"] -- to do: diesen Block später rausschmeißen und obigen aktivieren, wenn fertig
local geocode = args["lat"] .. "," .. args["lon"] -- to do: diesen Block später rausschmeißen und obigen aktivieren, wenn fertig
if geocode ~= "Geocoding failed" then
if geocode ~= "Geocoding failed" then
Zeile 130: Zeile 133:
end -- to do: obsolete, wenn sobobject genutzt
end -- to do: obsolete, wenn sobobject genutzt
-- GeoJson
-- GeoJson
if wik.pageExists(geojson_fullpagename) then
if geoobjects.geojson.exists then
setAttr(attrlist, "GeoJson", geojson_fullpagename)
setAttr(attrlist, "GeoJson", geoobjects.geojson.fullpagename)
end
end
-- zoom
-- zoom
Zeile 152: Zeile 155:
["enablefullscreen"] = "yes", ["resizable"] = "yes"}
["enablefullscreen"] = "yes", ["resizable"] = "yes"}
-- geojson-Argument
-- geojson-Argument
if wik.pageExists(geojson_fullpagename) then
if geoobjects.geojson.exists then
map_args["geojson"] = geojson_pagename
map_args["geojson"] = geoobjects.geojson.pagename
if #geoobjects > 0 then
if #geoobjects > 0 then
kategorien["Hat geojson und location/lat/lon"] = true
kategorien["Hat geojson und location/lat/lon"] = true
Zeile 159: Zeile 162:
end
end
-- location/lat/lon-Argumente
-- location/lat/lon-Argumente
if not (wik.pageExists(geojson_fullpagename) and -- Pin-Anzeige deaktivieren, wenn GeoJson vorhanden und hide_loc_latlon=Ja
if not (geoobjects.geojson.exists 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 181: Zeile 184:
-- 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
if geoobjects.geojson.arg ~= nil and map_args["geojson"] == nil then
t = t .. "<small>Karte [" .. geojson_url .. " " .. args["geojson"] .. "] nicht gefunden</small>"
t = t .. "<small>Karte [" .. geoobjects.geojson.url .. " " .. geoobjects.geojson.arg .. "] nicht gefunden</small>"
end
end
else
else
if com.isTrue(args["form"]) then
if com.isTrue(args["form"]) then
t = t .. "Positionsangabe fehlt oder fehlende Karte<br>" .. geojson_fullpagename .. "<br>Bitte Position in Formular eintragen oder"
t = t .. "Positionsangabe fehlt oder fehlende Karte<br>" .. geoobjects.geojson.fullpagename .. "<br>Bitte Position in Formular eintragen oder"
else
else
t = t .. "Breiten-/Längengrad (lat/lon) fehlt, Objekt-Lokation (location) fehlt oder fehlende Karte<br>" .. geojson_fullpagename
t = t .. "Breiten-/Längengrad (lat/lon) fehlt, Objekt-Lokation (location) fehlt oder fehlende Karte<br>" .. geoobjects.geojson.fullpagename
end
end
t = t .. "<br>[" .. geojson_url .. " Hier klicken zum Anlegen der Karte<br>" .. geojson_fullpagename .. "].<br>Siehe auch [[Hilfe:Karten]]"
t = t .. "<br>[" .. geoobjects.geojson.url .. " Hier klicken zum Anlegen der Karte<br>" .. geoobjects.geojson.fullpagename .. "].<br>Siehe auch [[Hilfe:Karten]]"
kategorien["Ohne Position"] = true
kategorien["Ohne Position"] = true
end
end
Zeile 196: Zeile 199:
-- Box um Karte
-- 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 geoobjects.geojson.arg or pagename
t = box.box{headline = headline, content = t, textalign = center}
t = box.box{headline = headline, content = t, textalign = center}
end
end
Zeile 213: Zeile 216:
end
end


mw.logObject(t, "t")
-- mw.logObject(t, "t")
t = frame:preprocess(t)
t = frame:preprocess(t)
return t, geoobjects
return t, geoobjects
end
function getGeocode(frame, location)
return frame:callParserFunction(
"#geocode", {location, format="float", directional="no"})
end
end