Jump to content

Module talk:Coordinates

Page contents not supported in other languages.
Coordinates: 52°28′59″N 1°53′37″W / 52.48306°N 1.89361°W / 52.48306; -1.89361
From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Dispenser (talk | contribs) at 18:01, 27 August 2013 (Update the GeoHack link: Labs' GeoHack is unsupported). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Examples
57°18′22″N 4°27′32″W / 57.30611°N 4.45889°W / 57.30611; -4.45889 57°18′22″N 4°27′32″W / 57.30611°N 4.45889°W / 57.30611; -4.45889
44°06′43″N 87°54′47″W / 44.112°N 87.913°W / 44.112; -87.913 44°06′43″N 87°54′47″W / 44.112°N 87.913°W / 44.112; -87.913
44°06′43″N 87°54′47″W / 44.112°N 87.913°W / 44.112; -87.913 44°06′43″N 87°54′47″W / 44.112°N 87.913°W / 44.112; -87.913
44°07′01″N 87°54′47″W / 44.117°N 87.913°W / 44.117; -87.913 (Klann Road) 44°07′01″N 87°54′47″W / 44.117°N 87.913°W / 44.117; -87.913 (Klann Road)
10°12′N 20°18′W / 10.2°N 20.3°W / 10.2; -20.3 10°12′N 20°18′W / 10.2°N 20.3°W / 10.2; -20.3
10°12′N 20°18′W / 10.2°N 20.3°W / 10.2; -20.3 10°12′N 20°18′W / 10.2°N 20.3°W / 10.2; -20.3
44°24′N 111°06′W / 44.4°N 111.1°W / 44.4; -111.1 44°24′N 111°06′W / 44.4°N 111.1°W / 44.4; -111.1
51°00′44″N 1°34′04″W / 51.01234°N 1.56789°W / 51.01234; -1.56789 51°00′44″N 1°34′04″W / 51.01234°N 1.56789°W / 51.01234; -1.56789
35°30′S 150°06′E / 35.5°S 150.1°E / -35.5; 150.1 35°30′S 150°06′E / 35.5°S 150.1°E / -35.5; 150.1
12°34′12″N 45°33′45″W / 12.57000°N 45.56250°W / 12.57000; -45.56250 12°34′12″N 45°33′45″W / 12.57000°N 45.56250°W / 12.57000; -45.56250
43°39′04″N 79°23′00″W / 43.651234°N 79.383333°W / 43.651234; -79.383333 43°39′04″N 79°23′00″W / 43.651234°N 79.383333°W / 43.651234; -79.383333
43°39′N 79°23′W / 43.65°N 79.38°W / 43.65; -79.38 43°39′N 79°23′W / 43.65°N 79.38°W / 43.65; -79.38
43°39′00″N 79°22′48″W / 43.6500°N 79.3800°W / 43.6500; -79.3800 43°39′00″N 79°22′48″W / 43.6500°N 79.3800°W / 43.6500; -79.3800
43°39′04″N 79°23′00″W / 43.651234°N 79.383333°W / 43.651234; -79.383333 43°39′04″N 79°23′00″W / 43.651234°N 79.383333°W / 43.651234; -79.383333
43°29′N 79°23′W / 43.483°N 79.383°W / 43.483; -79.383 43°29′N 79°23′W / 43.483°N 79.383°W / 43.483; -79.383
43°29′4″N 79°23′0″W / 43.48444°N 79.38333°W / 43.48444; -79.38333 43°29′4″N 79°23′0″W / 43.48444°N 79.38333°W / 43.48444; -79.38333
43°29′4.5″N 79°23′0.5″W / 43.484583°N 79.383472°W / 43.484583; -79.383472 43°29′4.5″N 79°23′0.5″W / 43.484583°N 79.383472°W / 43.484583; -79.383472
55°45′08″N 37°36′56″E / 55.752222°N 37.615556°E / 55.752222; 37.615556 55°45′08″N 37°36′56″E / 55.752222°N 37.615556°E / 55.752222; 37.615556
55°45′08″N 37°36′56″E / 55.752222°N 37.615556°E / 55.752222; 37.615556 55°45′08″N 37°36′56″E / 55.752222°N 37.615556°E / 55.752222; 37.615556
39°05′53″N 94°35′14″W / 39.098095°N 94.587307°W / 39.098095; -94.587307 39°05′53″N 94°35′14″W / 39.098095°N 94.587307°W / 39.098095; -94.587307
55°45′08″N 37°36′56″E / 55.752222°N 37.615556°E / 55.752222; 37.615556 (Moscow) 55°45′08″N 37°36′56″E / 55.752222°N 37.615556°E / 55.752222; 37.615556 (Moscow)
33°55′S 18°25′E / 33.917°S 18.417°E / -33.917; 18.417 33°55′S 18°25′E / 33.917°S 18.417°E / -33.917; 18.417
35°00′N 105°00′E / 35.000°N 105.000°E / 35.000; 105.000 35°00′N 105°00′E / 35.000°N 105.000°E / 35.000; 105.000
22°54′30″S 43°14′37″W / 22.90833°S 43.24361°W / -22.90833; -43.24361 22°54′30″S 43°14′37″W / 22.90833°S 43.24361°W / -22.90833; -43.24361
22°S 43°W / 22°S 43°W / -22; -43 22°S 43°W / 22°S 43°W / -22; -43
52°28′59″N 1°53′37″W / 52.48306°N 1.89361°W / 52.48306; -1.89361 52°28′59″N 1°53′37″W / 52.48306°N 1.89361°W / 52.48306; -1.89361
46°43′N 7°58′E / 46.717°N 7.967°E / 46.717; 7.967 46°43′N 7°58′E / 46.717°N 7.967°E / 46.717; 7.967
51°30′02″N 0°07′29″W / 51.500611°N 0.124611°W / 51.500611; -0.124611 51°30′02″N 0°07′29″W / 51.500611°N 0.124611°W / 51.500611; -0.124611
51°30′02″N 0°07′29″W / 51.500611°N 0.124611°W / 51.500611; -0.124611 51°30′02″N 0°07′29″W / 51.500611°N 0.124611°W / 51.500611; -0.124611
51°30′02″N 0°07′29″W / 51.500611°N 0.124611°W / 51.500611; -0.124611 51°30′02″N 0°07′29″W / 51.500611°N 0.124611°W / 51.500611; -0.124611
51°30′02″N 0°07′29″W / 51.500611°N 0.124611°W / 51.500611; -0.124611 51°30′02″N 0°07′29″W / 51.500611°N 0.124611°W / 51.500611; -0.124611
0°N 90°W / 0°N 90°W / 0; -90 0°N 90°W / 0°N 90°W / 0; -90
40°30′N 82°30′W / 40.5°N 82.5°W / 40.5; -82.5 40°30′N 82°30′W / 40.5°N 82.5°W / 40.5; -82.5
51°01′59″N 13°43′48″E / 51.033°N 13.73°E / 51.033; 13.73 51°01′59″N 13°43′48″E / 51.033°N 13.73°E / 51.033; 13.73
40°41′21″N 74°02′40″W / 40.6892°N 74.0445°W / 40.6892; -74.0445 40°41′21″N 74°02′40″W / 40.6892°N 74.0445°W / 40.6892; -74.0445
45°30′58″N 122°40′24″W / 45.516194°N 122.673226°W / 45.516194; -122.673226 45°30′58″N 122°40′24″W / 45.516194°N 122.673226°W / 45.516194; -122.673226
46°57′09″N 7°26′23″E / 46.9524°N 7.4396°E / 46.9524; 7.4396 46°57′09″N 7°26′23″E / 46.9524°N 7.4396°E / 46.9524; 7.4396
52°30′59″N 13°22′39″E / 52.5164°N 13.3775°E / 52.5164; 13.3775 52°30′59″N 13°22′39″E / 52.5164°N 13.3775°E / 52.5164; 13.3775
0°40′26.69″N 23°28′22.69″E / 0.6740806°N 23.4729694°E / 0.6740806; 23.4729694 0°40′26.69″N 23°28′22.69″E / 0.6740806°N 23.4729694°E / 0.6740806; 23.4729694
48°16′08″N 225°59′24″W / 48.269°N 225.990°W / 48.269; -225.990 48°16′08″N 225°59′24″W / 48.269°N 225.990°W / 48.269; -225.990
7°30′S 303°00′E / 7.5°S 303°E / -7.5; 303 7°30′S 303°00′E / 7.5°S 303°E / -7.5; 303
8°00′N 190°30′W / 8°N 190.5°W / 8; -190.5 8°00′N 190°30′W / 8°N 190.5°W / 8; -190.5
57°18′22″N 4°27′32″W / 57.30611°N 4.45889°W / 57.30611; -4.45889 57°18′22″N 4°27′32″W / 57.30611°N 4.45889°W / 57.30611; -4.45889
44°06′43″N 87°54′47″W / 44.112°N 87.913°W / 44.112; -87.913 44°06′43″N 87°54′47″W / 44.112°N 87.913°W / 44.112; -87.913
44°06′43″N 87°54′47″W / 44.112°N 87.913°W / 44.112; -87.913 44°06′43″N 87°54′47″W / 44.112°N 87.913°W / 44.112; -87.913
44°07′01″N 87°54′47″W / 44.117°N 87.913°W / 44.117; -87.913 (Klann Road) 44°07′01″N 87°54′47″W / 44.117°N 87.913°W / 44.117; -87.913 (Klann Road)
10°12′N 20°18′W / 10.2°N 20.3°W / 10.2; -20.3 10°12′N 20°18′W / 10.2°N 20.3°W / 10.2; -20.3
10°12′N 20°18′W / 10.2°N 20.3°W / 10.2; -20.3 10°12′N 20°18′W / 10.2°N 20.3°W / 10.2; -20.3
44°24′N 111°06′W / 44.4°N 111.1°W / 44.4; -111.1 44°24′N 111°06′W / 44.4°N 111.1°W / 44.4; -111.1
51°00′44″N 1°34′04″W / 51.01234°N 1.56789°W / 51.01234; -1.56789 51°00′44″N 1°34′04″W / 51.01234°N 1.56789°W / 51.01234; -1.56789
35°30′S 150°06′E / 35.5°S 150.1°E / -35.5; 150.1 35°30′S 150°06′E / 35.5°S 150.1°E / -35.5; 150.1
12°34′12″N 45°33′45″W / 12.57000°N 45.56250°W / 12.57000; -45.56250 12°34′12″N 45°33′45″W / 12.57000°N 45.56250°W / 12.57000; -45.56250
43°39′04″N 79°23′00″W / 43.651234°N 79.383333°W / 43.651234; -79.383333 43°39′04″N 79°23′00″W / 43.651234°N 79.383333°W / 43.651234; -79.383333
43°39′N 79°23′W / 43.65°N 79.38°W / 43.65; -79.38 43°39′N 79°23′W / 43.65°N 79.38°W / 43.65; -79.38
43°39′00″N 79°22′48″W / 43.6500°N 79.3800°W / 43.6500; -79.3800 43°39′00″N 79°22′48″W / 43.6500°N 79.3800°W / 43.6500; -79.3800
43°39′04″N 79°23′00″W / 43.651234°N 79.383333°W / 43.651234; -79.383333 43°39′04″N 79°23′00″W / 43.651234°N 79.383333°W / 43.651234; -79.383333
43°29′N 79°23′W / 43.483°N 79.383°W / 43.483; -79.383 43°29′N 79°23′W / 43.483°N 79.383°W / 43.483; -79.383
43°29′4″N 79°23′0″W / 43.48444°N 79.38333°W / 43.48444; -79.38333 43°29′4″N 79°23′0″W / 43.48444°N 79.38333°W / 43.48444; -79.38333
43°29′4.5″N 79°23′0.5″W / 43.484583°N 79.383472°W / 43.484583; -79.383472 43°29′4.5″N 79°23′0.5″W / 43.484583°N 79.383472°W / 43.484583; -79.383472
55°45′08″N 37°36′56″E / 55.752222°N 37.615556°E / 55.752222; 37.615556 55°45′08″N 37°36′56″E / 55.752222°N 37.615556°E / 55.752222; 37.615556
55°45′08″N 37°36′56″E / 55.752222°N 37.615556°E / 55.752222; 37.615556 55°45′08″N 37°36′56″E / 55.752222°N 37.615556°E / 55.752222; 37.615556
39°05′53″N 94°35′14″W / 39.098095°N 94.587307°W / 39.098095; -94.587307 39°05′53″N 94°35′14″W / 39.098095°N 94.587307°W / 39.098095; -94.587307
55°45′08″N 37°36′56″E / 55.752222°N 37.615556°E / 55.752222; 37.615556 (Moscow) 55°45′08″N 37°36′56″E / 55.752222°N 37.615556°E / 55.752222; 37.615556 (Moscow)
33°55′S 18°25′E / 33.917°S 18.417°E / -33.917; 18.417 33°55′S 18°25′E / 33.917°S 18.417°E / -33.917; 18.417
35°00′N 105°00′E / 35.000°N 105.000°E / 35.000; 105.000 35°00′N 105°00′E / 35.000°N 105.000°E / 35.000; 105.000
22°54′30″S 43°14′37″W / 22.90833°S 43.24361°W / -22.90833; -43.24361 22°54′30″S 43°14′37″W / 22.90833°S 43.24361°W / -22.90833; -43.24361
22°S 43°W / 22°S 43°W / -22; -43 22°S 43°W / 22°S 43°W / -22; -43
52°28′59″N 1°53′37″W / 52.48306°N 1.89361°W / 52.48306; -1.89361 52°28′59″N 1°53′37″W / 52.48306°N 1.89361°W / 52.48306; -1.89361
46°43′N 7°58′E / 46.717°N 7.967°E / 46.717; 7.967 46°43′N 7°58′E / 46.717°N 7.967°E / 46.717; 7.967
51°30′02″N 0°07′29″W / 51.500611°N 0.124611°W / 51.500611; -0.124611 51°30′02″N 0°07′29″W / 51.500611°N 0.124611°W / 51.500611; -0.124611
51°30′02″N 0°07′29″W / 51.500611°N 0.124611°W / 51.500611; -0.124611 51°30′02″N 0°07′29″W / 51.500611°N 0.124611°W / 51.500611; -0.124611
51°30′02″N 0°07′29″W / 51.500611°N 0.124611°W / 51.500611; -0.124611 51°30′02″N 0°07′29″W / 51.500611°N 0.124611°W / 51.500611; -0.124611
51°30′02″N 0°07′29″W / 51.500611°N 0.124611°W / 51.500611; -0.124611 51°30′02″N 0°07′29″W / 51.500611°N 0.124611°W / 51.500611; -0.124611
0°N 90°W / 0°N 90°W / 0; -90 0°N 90°W / 0°N 90°W / 0; -90
40°30′N 82°30′W / 40.5°N 82.5°W / 40.5; -82.5 40°30′N 82°30′W / 40.5°N 82.5°W / 40.5; -82.5
51°01′59″N 13°43′48″E / 51.033°N 13.73°E / 51.033; 13.73 51°01′59″N 13°43′48″E / 51.033°N 13.73°E / 51.033; 13.73
40°41′21″N 74°02′40″W / 40.6892°N 74.0445°W / 40.6892; -74.0445 40°41′21″N 74°02′40″W / 40.6892°N 74.0445°W / 40.6892; -74.0445
45°30′58″N 122°40′24″W / 45.516194°N 122.673226°W / 45.516194; -122.673226 45°30′58″N 122°40′24″W / 45.516194°N 122.673226°W / 45.516194; -122.673226
46°57′09″N 7°26′23″E / 46.9524°N 7.4396°E / 46.9524; 7.4396 46°57′09″N 7°26′23″E / 46.9524°N 7.4396°E / 46.9524; 7.4396
52°30′59″N 13°22′39″E / 52.5164°N 13.3775°E / 52.5164; 13.3775 52°30′59″N 13°22′39″E / 52.5164°N 13.3775°E / 52.5164; 13.3775
0°40′26.69″N 23°28′22.69″E / 0.6740806°N 23.4729694°E / 0.6740806; 23.4729694 0°40′26.69″N 23°28′22.69″E / 0.6740806°N 23.4729694°E / 0.6740806; 23.4729694
48°16′08″N 225°59′24″W / 48.269°N 225.990°W / 48.269; -225.990 48°16′08″N 225°59′24″W / 48.269°N 225.990°W / 48.269; -225.990
7°30′S 303°00′E / 7.5°S 303°E / -7.5; 303 7°30′S 303°00′E / 7.5°S 303°E / -7.5; 303
8°00′N 190°30′W / 8°N 190.5°W / 8; -190.5 8°00′N 190°30′W / 8°N 190.5°W / 8; -190.5

Fix display inline/title shortcut

With display=i it displays the coodinates at the title, and display=t it displays them inline. Function coordinates.coord must be fixed. Instead of:

    if string.find( Display, 'inline' ) ~= nil or Display == 't' or 
            Display == 'it' or Display == 'ti' then
        text = displayinline(contents, Notes)
    end
    if string.find( Display, 'title' ) ~= nil or Display == 'i' or 
            Display == 'it' or Display == 'ti' then
        text = text .. displaytitle(contents, Notes)
    end

it should be:

    if string.find( Display, 'inline' ) ~= nil or Display == 'i' or 
            Display == 'it' or Display == 'ti' then
        text = displayinline(contents, Notes)
    end
    if string.find( Display, 'title' ) ~= nil or Display == 't' or 
            Display == 'it' or Display == 'ti' then
        text = text .. displaytitle(contents, Notes)
    end

--Vriullop (talk) 19:58, 29 March 2013 (UTC)[reply]

Fixed. Good catch. Dragons flight (talk) 21:15, 29 March 2013 (UTC)[reply]

Geo microformat

I think this module (and the old coord template) currently contradicts against Geo specification. latitude and longitude classes should be given to machine-readable representation and be in geo class. Can someone fix it? --fryed-peach (talk) 01:26, 30 March 2013 (UTC)[reply]

I think specPrinter function should be
Code sample
--[[
specPrinter
 
Output formatter.  Takes the structure generated by either parseDec
or parseDMS and formats it for inclusion on Wikipedia.
]]
function specPrinter(args, coordinateSpec)
    local uriComponents = coordinateSpec["param"]
    if uriComponents == "" then
        -- RETURN error, should never be empty or nil
        return "ERROR param was empty"
    end
    if args["name"] ~= "" and args["name"] ~= nil then
        uriComponents = uriComponents .. "&title=" .. mw.uri.encode(coordinateSpec["name"])
    end
 
    local geodmshtml = '<span class="geo-dms" title="Maps, aerial photos, and other data for this location">'
             .. '<span class="nowrap">' .. coordinateSpec["dms-lat"] .. '</span> '
             .. '<span class="nowrap">' ..coordinateSpec["dms-long"] .. '</span>'
             .. '</span>'
 
    local lat = tonumber( coordinateSpec["dec-lat"] ) or 0
    if lat < 0 then
        -- FIXME this breaks the pre-existing precision
        geodeclat = coordinateSpec["dec-lat"]:sub(2) .. "°S"
    else
        geodeclat = (coordinateSpec["dec-lat"] or 0) .. "°N"
    end
 
    local long = tonumber( coordinateSpec["dec-long"] ) or 0
    if long < 0 then
        -- FIXME does not handle unicode minus
        geodeclong = coordinateSpec["dec-long"]:sub(2) .. "°W"
    else
        geodeclong = (coordinateSpec["dec-long"] or 0) .. "°E"
    end
 
    local geodechtml = '<span class="geo-dec" title="Maps, aerial photos, and other data for this location">'
             .. '<span class="nowrap">' .. geodeclat .. '</span> '
             .. '<span class="nowrap">' .. geodeclong .. '</span>'
             .. '</span>'
 
    local geonumhtml = '<span class="geo">'
             .. '<span class="latitude">' .. coordinateSpec["dec-lat"] .. '</span>; '
             .. '<span class="longitude">' .. coordinateSpec["dec-long"] .. '</span>'
             .. '</span>'
 
    local inner;
    inner = '<span class="' .. displayDefault(coordinateSpec["default"], "dms" ) .. '">' .. geodmshtml .. '</span>'
                .. '<span class="geo-multi-punct">&#xfeff; / &#xfeff;</span>'
                .. '<span class="' .. displayDefault(coordinateSpec["default"], "dec" ) .. '">';
 
    if args["name"] == "" or args["name"] == nil then
        inner = inner .. geodechtml 
                .. '<span style="display:none">&#xfeff; / ' .. geonumhtml .. '</span></span>'
    else
        inner = inner .. '<span class="vcard">' .. geodechtml 
                .. '<span style="display:none">&#xfeff; / ' .. geonumhtml .. '</span>'
                .. '<span style="display:none">&#xfeff; (<span class="fn org">'
                .. args["name"] .. '</span>)</span></span></span>'
    end
 
    return '<span class="plainlinks nourlexpansion">' .. globalFrame:preprocess(
        '[http://toolserver.org/~geohack/geohack.php?pagename={{FULLPAGENAMEE}}&params=' ..
        uriComponents .. ' ' .. inner .. ']') .. '</span>'
end

--fryed-peach (talk) 23:51, 31 March 2013 (UTC)[reply]

Honestly, I don't know the issues well enough to know if a change is appropriate here or not. Perhaps it would be good to discuss the specification issue at Template talk:Coord or one of the relevant WikiProjects (Wikipedia:WikiProject Geographical coordinates / Wikipedia:WikiProject Microformats)? Dragons flight (talk) 00:18, 1 April 2013 (UTC)[reply]
I introduced the geo microformat to Wikipedia; and founded the microformat project. I'm not a Lua coder, but I understand the necessary HTML. Can I help? Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 15:44, 1 April 2013 (UTC)[reply]
Thanks! Currently 57°18′22″N 4°27′32″W / 57.30611°N 4.45889°W / 57.30611; -4.45889 produces
<span class="plainlinks nourlexpansion">[http://toolserver.org/~geohack/geohack.php?pagename=Module_talk:Coordinates&params=57_18_22_N_4_27_32_W_ <span class="geo-default"><span class="geo-dms" title="Maps, aerial photos, and other data for this location"><span class="latitude">57°18′22″N</span> <span class="longitude">4°27′32″W</span></span></span><span class="geo-multi-punct"> / </span><span class="geo-nondefault"><span class="geo-dec" title="Maps, aerial photos, and other data for this location">57.30611°N 4.45889°W</span><span style="display:none"> / <span class="geo">57.30611; -4.45889</span></span></span>]</span>
But according to Geo specification, latitude and longitude classes should be inside of geo class and should include machine-readable coodinates. So it should produce
<span class="plainlinks nourlexpansion">[http://toolserver.org/~geohack/geohack.php?pagename=Module_talk:Coordinates&params=57_18_22_N_4_27_32_W_ <span class="geo-default"><span class="geo-dms" title="Maps, aerial photos, and other data for this location"><span class="nowrap">57°18′22″N</span> <span class="nowrap">4°27′32″W</span></span></span><span class="geo-multi-punct"> / </span><span class="geo-nondefault"><span class="geo-dec" title="Maps, aerial photos, and other data for this location"><span class="nowrap">57.30611°N</span> <span class="nowrap">4.45889°W</span></span><span style="display:none"> / <span class="geo"><span class="latitude">57.30611</span>; <span class="longitude">-4.45889</span></span></span>]</span>
instead. (extra nowrap classes are for correct text wrapping.) Am I right? --fryed-peach (talk) 09:54, 2 April 2013 (UTC)[reply]
No; <span class="geo">57.30611; -4.45889</span> (with a semi-colon) is a valid Geo microformat. Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 19:50, 2 April 2013 (UTC)[reply]
Oh I overlooked it. Then, latitude and longitude class should be eliminated altogether? What do you think of? They are currently used for "white-space:nowrap". I think we should replace them with "nowrap" classes and also give "nowrap" class to decimal coodinates. --fryed-peach (talk) 05:28, 3 April 2013 (UTC)[reply]
That would make no difference to the Geo microformat. You'd need to be careful that those class names aren't used by users, in their local stylesheets, for styling. Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 10:31, 3 April 2013 (UTC)[reply]
If there is a name parameter other than pagename then it should be <div class="geo">Name: <span class="latitude">57.30611</span>; <span class="longitude">-4.45889</span></div>. Right? --Vriullop (talk) 07:29, 3 April 2013 (UTC)[reply]
The Geo microformat doesn't have a name parameter. You could use the markup you suggest (it would still be a valid Geo microformat), but I don't see anything gained by doing so. Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 10:31, 3 April 2013 (UTC)[reply]
Sorry, I misunderstood it. Geo Spec reads: "the publisher must use hCard instead of just geo to publish the name and geo lat/long of the location." This gets me confused when a page has multiple coordinates with multiple names. --Vriullop (talk) 12:29, 3 April 2013 (UTC)[reply]

Not protocol-neutral

This module does not return a protocol-neutral URL (or whatever it's called). It's always http:// - please see Template talk:GeoTemplate#Https for Wikipedia link in this template. --Redrose64 (talk) 17:12, 10 April 2013 (UTC)[reply]

Am I correct that the way to do this is to replace things like:
http://toolserver.org/~geohack/geohack.php
with
//toolserver.org/~geohack/geohack.php
I've never really worried about protocol neutral URLs, so I want to make sure. Dragons flight (talk) 17:30, 10 April 2013 (UTC)[reply]
Yes, but with two caveats: (i) only if the ultimate wikicode has a left-square bracket as the immediately-preceding character; and (ii) only if the target server respects both the http: and https: protocols.
In the specific case of Module:Coordinates as it presently (19:57, 10 April 2013 (UTC)) stands, both of these two conditions are satisfied because the string constant reads '[http://toolserver.org/~geohack/geohack.php?pagename={{FULLPAGENAMEE}}&params=' and toolserver is happy to be accessed as https://toolserver.org/ so it may be altered to '[//toolserver.org/~geohack/geohack.php?pagename={{FULLPAGENAMEE}}&params=' --Redrose64 (talk) 19:57, 10 April 2013 (UTC)[reply]
Okay, done. Dragons flight (talk) 20:11, 10 April 2013 (UTC)[reply]

Odd default direction in dms2dec

As the code stands today, if the direction parameter is passed empty in dms2dec, then factor is set to -1. In other words, the code assumes that the default hemisphere is South or West. That's rather surprising.

Perhaps direction should be set explicitly to "E" if empty or nil? —hike395 (talk) 05:13, 30 April 2013 (UTC)[reply]

I just noticed that the GeoHack tool has been moved to Labs. So, idealy, the link to GeoHack should be changed so that it links to Labs - like so:

//toolserver.org/~geohack/geohack.php

should be changed to

//tools.wmflabs.org/geohack/geohack.php

--Snaevar (talk) 13:41, 2 June 2013 (UTC)[reply]

Done. Dragons flight (talk) 04:43, 5 June 2013 (UTC)[reply]
Sorry for my absence, but Labs is running an unsupported shoddy copy of GeoHack and the official version still on the Toolserver. Additionally, this change should've somehow be made at Template:Coor URL. — Dispenser 18:01, 27 August 2013 (UTC)[reply]

Nonsense value for the parameter "display" kills the text to be returned

Hallo. I just found a very ugly bug of this module. If you use the following code, thus, with a nonsense value for the parameter "display":

{{#Invoke:Coordinates| coord |11.5|-153.43333333333|display=elephant}}

then it returns nothing: . I found a solution for this bug. The part

    local text = ''
    if string.find( Display, 'inline' ) ~= nil or Display == 'i' or 
            Display == 'it' or Display == 'ti' then
        text = displayinline(contents, Notes)
    end
    if string.find( Display, 'title' ) ~= nil or Display == 't' or 
            Display == 'it' or Display == 'ti' then
        text = text .. displaytitle(contents, Notes)
    end
    return text

has to be changed into

    local text = ''
    local nothing = ''
    if string.find( Display, 'inline' ) ~= nil or Display == 'i' or 
            Display == 'it' or Display == 'ti' then
        text = displayinline(contents, Notes)
    else nothing = "i"
    end
    if string.find( Display, 'title' ) ~= nil or Display == 't' or 
            Display == 'it' or Display == 'ti' then
        text = text .. displaytitle(contents, Notes)
    else if nothing = "i" then text = displayinline(contents, Notes)
         end
    end
    return text

I just tested this solution on a testing page of the Esperanto Wikpedia. It works very fine there. Greetings --Tlustulimu (talk) 12:26, 29 June 2013 (UTC)[reply]

Wouldn't it be better to return an error message and tracking category rather than simply assuming that the user who entered "elephant" really meant inline? Dragons flight (talk) 15:43, 29 June 2013 (UTC)[reply]
Yes, because the error may be a misspelling of "title". Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 15:26, 4 August 2013 (UTC)[reply]
What CoI? Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 15:26, 4 August 2013 (UTC)[reply]

Strange results

Hallo. I just tested the function dmsdec in this module. But some results are wrong:

{{#Invoke:Coordinates | dms2dec | N|52|28|59 }}
{{#Invoke:Coordinates | dms2dec | S|52|28|59 }}

returns: 52.48306 -52.48306 Why the results are the same for North and South?

{{#Invoke:Coordinates | dms2dec | W|1|53|37 }}
{{#Invoke:Coordinates | dms2dec | E|1|53|37 }}

returns: -1.89361 1.89361 Why the results for East and West are the same? Greetings --Tlustulimu (talk) 22:57, 29 June 2013 (UTC)[reply]

Fixed. The spaces needed trimming from the parameter before comparison. -- WOSlinker (talk) 23:19, 29 June 2013 (UTC)[reply]
Thank you :-) --Tlustulimu (talk) 23:33, 29 June 2013 (UTC)[reply]

Wikidata

It is now easy to retrieve coordinates from Wikidata:

mw.wikibase.getEntity().claims.p625[0].mainsnak.datavalue.value["latitude"]

Should it be added to this module or further downstream ? --Superzoulou (talk) 06:54, 10 July 2013 (UTC)[reply]

Hallo. I just corrected the bug in the link to the toolserver, if there are coordinates in southern or western hemisphere. E.g. {{coord|43.651234|-79.383333}} now returns a negative value for the longitude and E in the link for the toolserver: 43°39′04″N 79°23′00″W / 43.651234°N 79.383333°W / 43.651234; -79.383333. This looks very strangely. The link text isn't concerned.

The following code in the function formatTest

result.param    = table.concat( {args[1], "_N_", args[2], "_E_", args[3] } );

has to be changed into

       local declat = tonumber( args[1], 10 ) or 0
        if declat < 0 then 
            dirNS = "_S_" 
            declat = 0 - declat
        else 
            dirNS = "_N_"   
            declat = args[1]
        end
        local declong = tonumber( args[2], 10 ) or 0
        if declong < 0 then 
            dirEW = "_W_"
            declong = 0 - declong
        else 
            dirEW = "_E_"    
            declong = args[2]
        end
        result.param    = table.concat( {declat, dirNS, declong, dirEW, args[3] } );
        --result.param    = table.concat( {args[1], "_N_", args[2], "_E_", args[3] } );

I tested the code on the Esperanto Wikipedia. It works very fine there: sandbox version with tests in its documentation. You can see the effect in a template too: Ŝablono:Koord/provejo. Greetings --Tlustulimu (talk) 07:41, 1 August 2013 (UTC)[reply]

I just corrected a little bit, because a function formatPoint is used in the code of the Esperanto Wikipedia, that doesn't exist here. Greetings --Tlustulimu (talk) 07:54, 1 August 2013 (UTC)[reply]