Module talk:Coordinates/Archive 2

Latest comment: 1 year ago by Johnuniq in topic Lua errors
Archive 1Archive 2

TPE on 11 Sep 2016

Could the sandbox versions of this module and {{Coord}} be merged into the main versions of each? This change would move the parser function {{#coordinates:}} into the module, allowing Wikidata to be used without generating errors, and would allow coordinates with latitude before longitude. Jc86035 (talk) Use {{re|Jc86035}}
to reply to me
16:23, 11 September 2016 (UTC)

@Jc86035: Some questions before a potential sync, since this is is very heavily transcluded. 1. What has been the extent of your testing and validation that your change in the module (and removal in the template) works correctly? 2. Despite WP:PERF, Could it have been possible to request this change in August and do a more cumulative sync to avoid having to edit twice to avoid server strain when possible? — Andy W. (talk ·ctb) 17:18, 11 September 2016 (UTC)
@Andy M. Wang: Removing edit request; there are a few changes I'd like to make to the p._coordinsert function first. Jc86035 (talk) Use {{re|Jc86035}}
to reply to me
02:14, 12 September 2016 (UTC)
@Andy M. Wang: Reactivated edit request; additional changes didn't work. Tested original conditions in Module talk:Coordinates/testcases (all test failures are due to the addition of the parser function and are expected) and Template:Coord/testcases. (TL;DR: Could the sandbox versions of this module and {{Coord}} be merged into the main versions of each?) Thanks, Jc86035 (talk) Use {{re|Jc86035}}
to reply to me
13:27, 13 September 2016 (UTC)
Synced module and template. Ping/reopen if there are pending issues, cheers — Andy W. (talk ·ctb) 15:50, 13 September 2016 (UTC)
Undid, followed up on your talk — Andy W. (talk ·ctb) 16:10, 13 September 2016 (UTC)

Usage of Module:Coordinates in Module:HS listed building results in error

Hi! There seems to be an issue with the Module:Coordinates after I added picture and Commonscat for an item in the List of Category A listed buildings in Highland. I'm not quite sure if this is a mistake on my side, but even looking at old versions of the list I still get the same error message "Lua error in Module:Coordinates at line 657: Tried to read nil global frame.". Does anyone here know how to fix this? Would be much appreciated! Braveheart (talk) 14:44, 20 September 2016 (UTC)

Backed out (for now, don't know if I have time to look into this) — Andy W. (talk ·ctb) 16:00, 20 September 2016 (UTC)
@Andy M. Wang: This could probably be solved (rather quickly) by modifying HS listed building to use {{Coord}} instead of this module + the #coordinates: parser function. Jc86035 (talk) Use {{re|Jc86035}}
to reply to me
16:02, 20 September 2016 (UTC)
@Jc86035: I set up a sandbox at for the HS listing building templates/modules that call the coordinates sandbox. Can test at Template:HS listed building row/testcases to make sure the nil global frame issue can be fixed by your suggestion. — Andy W. (talk ·ctb) 16:09, 20 September 2016 (UTC)
@Jc86035: A list of modules that looks to be tangentially related or possibly be affected by the change. (very rough list, didn't go further into detail): Module:FindFeatures, Module:FindFeatures/displayDatabase, Module:Geobox coor, Module:HS listed building (error reported), Module:Location map, Module:WikidataCoord, Module:Parameters, Module:OSM, Module:WikidataIB, Module:Solar eclipse, Module:Wikidata2. Modules like Module:WikidataIB, Module:Geobox coor, and Module:Solar eclipse call expandTemplate on coord. I can't tell if any other module is using Coordinates like HS listed building is. A bit busy right now, but may find the time still to call the module directly rather than the template, which I believe is better practice — Andy W. (talk ·ctb) 17:51, 20 September 2016 (UTC)
@Andy M. Wang: I think HS listed building is likely the only module which calls Module:Coordinates directly, so none of the others should be affected. In any case, their uses would show up in Category:Pages with script errors. My Lua skills do not extend very far beyond the Ustring library, regular expressions and concatenating HTML, so it's probably up to a more experienced coder to do this. Jc86035 (talk) Use {{re|Jc86035}}
to reply to me
11:09, 21 September 2016 (UTC)
Never mind, I didn't notice that Jackmcbarn fixed it. Hopefully I haven't introduced any other weird errors in the module. Jc86035 (talk) Use {{re|Jc86035}}
to reply to me
11:14, 21 September 2016 (UTC)
Synced again, didn't find any other compatibility issues — Andy W. (talk ·ctb) 04:59, 22 September 2016 (UTC)
I just updated Module:Geobox coor to use this module directly. please revert and let me know if there are any serious problems. Frietjes (talk) 14:36, 20 October 2016 (UTC)

Coordinates not on Wikidata

Why is YouTube categorized in this category when there are coordinates on Wikidata? --Obsuser (talk) 16:03, 17 May 2017 (UTC)

This happens because YouTube on Wikidata does not have a "coordinate location" (P625) property, I believe. – Jonesey95 (talk) 16:12, 17 May 2017 (UTC)

adding a place name through coordinsert

I have added an additional feature to coordinsert in Module:Coordinates/sandbox to allow for |name= to add a place name. with this addition, {{coord|0.3|0.4|region:US|name=foobar}} is equivalent to {{#invoke:coordinates/sandbox|coordinsert|{{coord|0.3|0.4|region:US}}|name=foobar}}. you can verify this through Special:ExpandTemplates. this feature is only activated when |name= is specified, so it should have zero impact on existing uses. if there are no objections or concerns, I plan to eventually update the live module. this will help migrate Template:Mountain index row to use fully use {{coord}} without having to duplicate the name information in the coordinates call. Frietjes (talk) 13:48, 7 June 2017 (UTC)

no objections after 4 weeks, so now added. Frietjes (talk) 14:16, 5 July 2017 (UTC)

Negative E and negative N coordinates

TheDJ posted a note on my talk page: "I think there is a bug: with {{coord|45.5039|-73.5876|region:CA|display=inline,title}}: 45°30′14″N 73°35′15″W / 45.5039°N 73.5876°W / 45.5039; -73.5876. This creates a link with -73 East, which is incorrect of course. I also suspect it will call out to the parser function this way and I think that's why coordinates in this format are not in the location database..." as far as I can tell, the only place where it is incorrect is in the url. I made this change to the sandbox, which appears to fix the problem: 45°30′14″N 73°35′15″W / 45.5039°N 73.5876°W / 45.5039; -73.5876. would there be a problem if I were to make the same change to the live template? is there something that I am missing? thank you. Frietjes (talk) 13:59, 19 December 2017 (UTC)

@Frietjes: looks good to me. —TheDJ (talkcontribs) 21:39, 19 December 2017 (UTC)

To summarise:

  • {{coord|45.5039|-73.5876}} is currently passed to geohack as params=45.5039_N_-73.5876_E
  • This is odd, as decimal notation usually doesn't specify N/S/W/E unless the values are positive
  • It also turns out that the parserfunction #coordinates from the GeoData extension doesn't support this format
  • Geohack however doesn't support passing: params=45.5039_-73.5876
  • Geohack in this case expects params=45.5039;-73.5876
  • wikiminiatlas doesn't seem to support params=45.5039;-73.5876

Sigh... so the change Frietjes proposes seems to be the best we can get right now :( —TheDJ (talkcontribs) 15:35, 27 December 2017 (UTC)

Convert to indicator

@Dragons flight, Frietjes, Jc86035, TheDJ, and MaxSem: I've implemented <indicator name="coordinates">...</indicator> in this change for phab:T67648. I don't know Lua, so please review. — JJMC89(T·C) 21:13, 24 March 2018 (UTC)

We will have to prepare new CSS for all skins for this indicator. Not too much of a problem, though sizing is a bit like playing with fire here as it wasn't particularly consistent in the old template (depended on where in the document you added it, and often it was inside font-small markers in the infobox). I have prepped something for Vector.css and monobook.css. It's a little bit bigger this way in almost any instance. However it is more consistent with the font size of the tagline ("From Wikipedia, the free encyclopedia"). opinions. Note that the css has to account for the old styling rules, as due to parser caching both the old and the new will need to live side by side for a while.. (prefix the old with .mw-parser-output class ?) —TheDJ (talkcontribs) 15:34, 26 March 2018 (UTC)

Sharing from Open Street Map

I have just been retrospectively trying to find some coords for en: and commons. I can find the building- there is a tab called share- and the side panel tells me that the centre point (my building) is/has geo:51.50161,-0.04668?z=17. Going back to the days of the manframe we were taught to make it simple for the user who is by definition simple- computer power is cheap. So how about letting me paste the text geo:51.50161,-0.04668?z=17 into the first field and let the server translate it into {{coord|51.50161|-0.04668}}. I assume the pseudo code for {{{1}}}} would be on the lines of if {{{1}}}!= text| {{{1}}}}| toreal({{{1:char(5)..char(13)}}}) with a cleanup for the position of the comma. The {{{2}}} field would need to come from {{{1}}} too. This would also allow for the named fields to be added too.ClemRutter (talk) 01:22, 10 January 2018 (UTC)

The correct venue for this request is WT:Lua.--Snaevar (talk) 20:54, 2 July 2020 (UTC)

Please update the geohack link like is shown in this diff (ignore the language=is, please). This is due to the change mentioned at https://wikitech.wikimedia.org/wiki/News/Toolforge.org . The link in question is broken currently and the aforementioned diff would fix it.--Snaevar (talk) 23:07, 7 July 2020 (UTC)

  DoneJonesey95 (talk) 23:19, 7 July 2020 (UTC)

Duplication of coordinates

Template:Infobox bridge gets the coordinates of the bridge from wikidata but this information is displayed twice on the article. Once in the top-right corner and again inside the infobox (example). This seems a bit excessive - is there something wrong with how this template is coded? — Martin (MSGJ · talk) 09:48, 22 September 2020 (UTC)

That is normal for many coordinate displays. See the "display" section of the documentation for {{Coord}}. What you are seeing is the "inline,title" option, which is used in many articles where infoboxes display coordinates. I think many editors are used to looking at the top right of the article for coordinates as a consistent location. – Jonesey95 (talk) 14:58, 22 September 2020 (UTC)
I guess I haven't noticed it before. I think standardisation is important, and I also think it is excessive to display it twice. Have there been any discussions about this? Is it mentioned in the manual of style? — Martin (MSGJ · talk) 08:19, 23 September 2020 (UTC)
I don't know of any discussions or guidelines. I think it's just something that has always happened. There are some infobox templates that manage to suppress the coordinates, and the "Coordinates" header, in the infobox when "display=title" is used in the coord template. I'd have to dig around for one, though. – Jonesey95 (talk) 15:14, 23 September 2020 (UTC)
Many, many articles use "inline,title" and show the coordinates at top-right and in the infobox. It looks a bit odd in Jarrow Bridge because the infobox is minimal with coordinates at the top of the text, but it is standard. Check articles for major cities, e.g. Paris. Johnuniq (talk) 01:51, 24 September 2020 (UTC)

@Jonesey95: please can you advise at Template talk:Infobox bridge#Multiple coordinates? Some articles already have {{coord}} and the infobox is duplicating the coordinates in the top-right corner, which is not good. — Martin (MSGJ · talk) 17:28, 24 September 2020 (UTC)

change needed

this change needs to be done --Ookrainer (talk) 17:51, 9 December 2020 (UTC)

  Not done: Lots of problems with this change. First of all, it makes convert_dms2dec ignore its direction parameter. If we don't want to use a direction parameter anymore, it should be removed, not just ignored. Also, your addition of " or 0" to the degrees case means that pages with malformed coordinates will end up claiming they're on Null Island rather than giving an error. As for the other changes, what specific problem are they solving? Jackmcbarn (talk) 21:43, 9 December 2020 (UTC)
Jackmcbarn, why does it make convert_dms2dec ignore its direction parameter? I am just purifing it by
direction = mw.ustring.gsub(direction, '^[ ]*(.-)[ ]*$', '%1');

an addition of " or 0" to the degrees is not always useful, here I can agree with you. --Ookrainer (talk) 21:58, 9 December 2020 (UTC)

@Ookrainer: You're right about the direction parameter, now that I look at it again. I misread what the gsub was operating on. But anyway, my other question still stands: how are these changes an improvement? Jackmcbarn (talk) 03:41, 10 December 2020 (UTC)

Updating Coord2text

@Evad37 and Jackmcbarn: The updates to Coord2text in Module:Coordinates/sandbox seem to work for the most part, however it's not rounding the dms conversion like it used to. See Template:Coord/testcases#Coord2text for examples. Also, instead of parsing the coordinates from the geohack URL, would it be possible to parse them from the spans instead (like was done in Module:Location map)? That should make it more future-proof. Kaldari (talk) 04:58, 8 December 2020 (UTC)

@Evad37 and Jackmcbarn: Due to the frequent changes to Module:Coordinates/sandbox, I moved our working test version to Module:Coordinates/sandbox2. The testcases at Template:Coord/testcases#Coord2text have also been updated. As you can see there, the dms converted results are not being rounded properly, but I imagine that would be easy to fix. Kaldari (talk) 00:18, 15 December 2020 (UTC)

Update the microformat

The good people on microformats.org are quite unhappy at the way geo is handled on Wikipedia, to the extent that I had no idea how to start a (globe) proposal with the "we need it on Wikipedia" justification. Some of the issues are:

  1. Outdated "geo" format. They prefer hGeo now, where the class names are a lot more consistent.
  2. Some data are nonsense, esp. when we do globe:

Now that Wikipedia:WikiProject Microformats have switched to the h- classes for everything but geo, it makes sense to move geo to the newer h-geo spec too.

--Artoria2e5 🌉 06:32, 8 March 2021 (UTC)

Straw edit request

Special:PermanentLink/1010953805 is my current attempt at updating the format using only minor tweaks without breaking backward compat. This fixes problem 1, but not yet problem 2. A procedure to parse the extra colon-style params into a dict is needed to fix 2. --Artoria2e5 🌉 06:32, 8 March 2021 (UTC)

  Not done: This is not how edit requests are to be used. It seems like you might want to start an RfC? Elli (talk | contribs) 21:36, 8 March 2021 (UTC)
I had in mind to look at this, thanks Elli for hitting the talk page for me. ;) Will look at some point in the next 24 hours. --Izno (talk) 00:46, 9 March 2021 (UTC)
@Artoria2e5: Your update seems to have broken coord2text. See the module testcases. --Izno (talk) 18:28, 10 March 2021 (UTC)

Update wikidata call

Implement Special:Diff/1026423137. It serves the same functionality as now, but does that more efficiently. Currently the module is loading the whole item into memory, instead of loading only the necessary statement, this change fixes that. Currently there is an memory issue on COVID-19 pandemic in India because of this (try to preview the page without the Coord template under the "first cases" in the infobox.) Snævar (talk) 05:56, 2 June 2021 (UTC)

  Done Izno (talk) 19:28, 4 June 2021 (UTC)

Template-protected edit request on 7 August 2021 Suggestion

Hello! The title coordinates are overlapping with other content on new Vector or if users have certain gadgets enabled. I'd like to propose a change to address this - make title coordinates use indicators. The only change that would need to be done to enable that is:

line 32:    return mw.getCurrentFrame():preprocess('<indicator name="coordinates">' .. co .. '</indicator>');

I am a hrwiki admin, I just adapted this module to hrwiki. You can see the proposed change here, and visit e.g. hr:Zagreb to see it in action (right side, parallel with page title).

It has become very difficult to use enwiki on new Vector, and this change would go a long way towards remedying that. Thank you! Ivi104 (talk) 00:27, 7 August 2021 (UTC)

I think this is the way to go, and would even propose replacing the in-title coordinates (the numbers) with icons only, similar to other indicators: UTF has 🌐 and 🗺. Ask yourself what those numbers mean to a reader, and whether you could tell which of the two cities, 48°1′N 16°2′E ans 45°5′N 15°6′E is the capital of a southeastern EU country, and which one is in Central Europe.
The solution with indicators is also present at Polish Wikipedia, pl:Nowy Jork.
On en.wiki, when New Vector is used, the in-title coordinates currently overlap with X-Tools, redirect templates (see New York City), info boxes (see Croatia), etc. Ponor (talk) 00:51, 7 August 2021 (UTC)
  Not done for now: See T281974, where this has been discussed in detail. Izno and TheDJ and maybe others may want to comment on this proposed workaround. – Jonesey95 (talk) 20:17, 7 August 2021 (UTC)
Yes, the discussion is at Template talk:Coord#Use page indicators?. Izno (talk) 17:17, 8 August 2021 (UTC)

Template-protected edit request on 12 August 2021

Changes:

  • Change line 469:
    • From:return errorPrinter({{"formatTest", "Unknown argument format"}})
    • To:return errorPrinter({{"formatTest", "Unknown argument format"}}) .. '[[Category:Pages with malformed coordinate tags]]'

This is because the function is returned here and never reaches line 482 for the category. ネイ (talk) 13:48, 12 August 2021 (UTC)Minor fix ネイ (talk) 13:48, 12 August 2021 (UTC)

  Done -- WOSlinker (talk) 18:15, 12 August 2021 (UTC)

#coordinates parser function

I'm getting the error 'Lua error: callParserFunction: function "#coordinates" was not found.' on my own install. I copied Template:Coord and Module:Coordinates from Wikipedia, along with all the associated templates. The parser function #coordinates is part of Module:Coordinates, correct? I'm not clear on why it can't find it. Redheadkelly (talk) 06:34, 20 August 2021 (UTC)

You need mw:Extension:GeoData -- WOSlinker (talk) 06:48, 20 August 2021 (UTC)
Or remove that part from Module:Coordinates of course. —TheDJ (talkcontribs) 11:11, 20 August 2021 (UTC)
Yep, that did it. Thanks so much. I didn't see that mentioned anywhere in the documentation. Redheadkelly (talk) 16:36, 20 August 2021 (UTC)
Well, did you document it for the next person ? :) —TheDJ (talkcontribs) 11:37, 21 August 2021 (UTC)

Addition of fallthrough coordinate to check for headquarters location on Wikidata

Noticed that University of Yangon exhibits the maintenance category of Category:Coordinates not on Wikidata, when it does have coordinates on Wikidata.

Searched for relevant discussions on Wikidata, and came across these https://www.wikidata.org/wiki/Wikidata:Project_chat/Archive/2021/03#coordinate_location_(P625)_to_headquarters_location_(P159)_switch and https://www.wikidata.org/wiki/Wikidata:Project_chat#DeltaBot's_coordinate_location_(P625)_to_headquarters_location_(P159)_move.

It appears as though DeltaBot made mangled changes to Wikidata which Wikidata does not wish to revert (such as bulk converting coordinate location (P625) properties to headquarters location (P159), which have flooded the Category:Coordinates not on Wikidata page with erroneous spam). So, instead, the module check should be corrected on Wikipedia to reflect these changes. Therefore, I propose implementing here in the module a check for headquarters location (P159) after coordinate location (P625).

The code area begins on line 494. Additional checks should be added for qid, "P159" with identical parallel logic to the "P625" checks.

I will happily whip this up, but I do not have template edit rights here. Let me know, thanks. Top5a (talk) 05:31, 9 April 2022 (UTC)

Top5a, I'll shortly be poking at Module:Coordinates/sandbox, but not likely in the same place. You may make any changes necessary there. When you are done, use {{template edit request}} indicating the changes are in the sandbox. I don't see anything particularly wrong with adjusting the module to account for this issue.
It might be wise still to emit a category for the case where HQ location is present but primary coordinates are not, but I'll leave that for your consideration. Izno (talk) 22:20, 26 June 2022 (UTC)

Incompatibility between coordinsert and the name= parameter

Background: Template talk:Infobox UK place#The OS_grid_reference parameter. See this version of Hatfield Chase, the coords URI in the title is

and this is valid. However, with this edit, the coords URI in the title becomes

which is not valid - the additional values for the params= parameter have been appended to the query string instead of being inserted at the appropriate place. This occurs because this code in Module:Coordinates:

	if args["name"] then
		uriComponents = uriComponents .. "&title=" .. mw.uri.encode(coordinateSpec["name"])
	end

is processed earlier than the

{{#invoke:Coordinates|coordinsert|{{{coordinates}}}|region:{{#ifeq:{{{crown_dependency|}}}|Isle of Man|IM|GB}}|type:city{{#iferror:{{#expr:{{formatnum:{{{population}}}|R}}*1}}||({{formatnum:{{{population}}}|R}})}}}}

line that is in Template:Infobox UK place. Is it possible to either (a) amend coordinsert so that the extra code is inserted (as per its name) rather than appended (as per what it actually does), producing this URI:

or (b) alter line 109 and anything dependent upon that so that the URI seen by coordinsert has the previous value of uriComponents last rather than first, producing this URI:

I am no Lua expert; I don't trust myself to write the proper patch. --Redrose64 🌹 (talk) 19:25, 8 June 2022 (UTC)

Redrose64 Should the name come last always? Or are there other URI parts that can come after? Izno (talk) 22:26, 26 June 2022 (UTC)
Hmm, according to our documentation

name= can be used to annotate inline coordinates for display in map services such as the WikiMiniAtlas. If omitted, the article's title (PAGENAME) is assumed. Note: a name= parameter causes {{Coord}} to emit an hCard microformat using that name, even if used within an existing hCard. Do not use when the name is that of a person (e.g for a gravesite), as the generated hCard would be invalid. Also, do not use square brackets in names.

Neither link is as expected if this is a true statement. Izno (talk) 22:43, 26 June 2022 (UTC)
And then the "do not use" instruction essentially contradicts that there is a default assumed. Izno (talk) 22:44, 26 June 2022 (UTC)
(edit conflict) In a URI, a query string begins with a question mark and ends with a hash character, or at the end of the URI if there is no fragment. The query string is made up of zero or more parameters separated by ampersands. A parameter is a name/value pair separated by an equals sign; an empty value is valid. So in my final example above there are three query parameters:
  • pagename=Hatfield_Chase
  • title=Tunnel+Pits
  • params=53.528_N_0.893_W_region:GB_type:city
and they may occur in any order. It is up to the server to interpret the value of each parameter, and the geohack server expects the value of a title parameter to be literal text, which is why for the second URI given above it's displaying "Tunnel+Pits_region:GB_type:city" - it doesn't know to do any different. --Redrose64 🌹 (talk) 22:47, 26 June 2022 (UTC)
they may occur in any order is sufficient. The |name= parameter seems to be functioning fine e.g. on Template:Prime meridian, so this may be something that cannot be fixed if it is not working on that page, but I will take a look. Izno (talk) 23:58, 26 June 2022 (UTC)
(b) is not possible (at least without a dramatic rearchitecting of how coordinsert does its work and wiki-wide scale change): Like templates, modules are expanded inside out, so coordinsert cannot be run before the content inside it is expanded.
Regarding (a), I think I can do this. However, that function also provides a totally separate parameter |name= to hold the name someone intends to add e.g. code similar to {{#invoke:coordinates|coordinsert|{{coord}}|key:value|name=Ipsum lorem}}. Consider if providing a passthrough parameter in the infobox instead will fix this problem satisfactorily. Izno (talk) 06:44, 27 June 2022 (UTC)
What could be done instead of (b) might be to move the title query parameter to the left rather than have it come last. Izno (talk) 06:46, 27 June 2022 (UTC)
I thought that's what I said - the URI seen by coordinsert has the previous value of uriComponents last rather than first, that is to say, coordinsert would see
and amend that to become:
Was this not clear? --Redrose64 🌹 (talk) 20:28, 27 June 2022 (UTC)
It was not. Izno (talk) 21:28, 27 June 2022 (UTC)

city() is broken

The city(9,999) parameter seems to be broken now, currently rendering everything after the "(" inline; e.g., as "7,456)_dim:3875&title=Mount+Pleasant 32°01′42″S 115°50′56″E" instead of just "32°01′42″S 115°50′56″E"; see Mount Pleasant, Western Australia. Betterkeks (talk) 09:31, 3 July 2022 (UTC)

No it's not. Its because {{wikidata |properties |current |P1082}} on that page returns multiplevalues for thecity parameter. —TheDJ (talkcontribs) 09:39, 3 July 2022 (UTC)
@TheDJ: 🤦‍♂️ Thank you! Sorry to waste your time. Betterkeks (talk) 18:21, 3 July 2022 (UTC)

Protected edit request on 14 September 2022

Please add functionality to Coordinates:coord to accept a format=dec4 parameter to round decimal degree coordinates to four decimal degrees. This will allow coordinates to be entered in more precise decimal formats (such as the seven decimal digits used by the United States Geological Survey), but to be displayed in a standard four decimal digit format comparable to the (somewhat outdated) dms format. Retaining the more precise coordinate inputs to Template;Coord will permit error checking with external data sources (such as USGS). Thank you very much,  Buaidh  talk e-mail 03:46, 14 September 2022 (UTC)

@Buaidh please can you make requested changes to Module:Coordinates/sandbox and test? — Martin (MSGJ · talk) 10:05, 21 September 2022 (UTC)
  Not done needs to be sandboxed and tested first. — xaosflux Talk 17:45, 25 September 2022 (UTC)

Allow custom error on empty coordinates

At the moment, when using {{Coord}}, if the coordinates are not available in Wikidata, it explodes with this red error message:

Coordinates: Missing latitude
Invalid arguments have been passed to the {{#coordinates:}} function

Instead, it could be nice to add an extra parameter to just silently ignore this error message. Something like {{Coord|error_message_no_coordinates=}}.

This will be very useful on use cases like {{Coord|error_message_no_coordinates=[[:Category:Bad coordinates]]}} since it allows easy embedding in templates and easy Wikidata integration.

Is it something that could be useful? --Valerio Bozzolan (talk) 15:54, 20 August 2022 (UTC)

@Valerio Bozzolan: Why would anyone use the {{coord}} template without including actual coordinates in it? (When one wants to draw on Wikidata for coords, one usually uses {{WikidataCoord}}, which produces the message "{{WikidataCoord}} – missing coordinate data" if coordinates are not present in Wikidata.) Deor (talk) 22:24, 20 August 2022 (UTC)
@Deor: I was interested in {{WikidataCoord}} but I think it has the same problem: it always generates a big red error when coordinates are missing (instead of being able to silently do nothing in that case, or just add a category), so at the moment it's not possible to add this template into an infobox, since it does not give backward-compatibility and will just spawn lot of errors in the encyclopedia. --Valerio Bozzolan (talk) 08:03, 21 August 2022 (UTC)
Valerio Bozzolan, maybe I misunderstand, but if you want to include {{coord}} directly in an infobox, you could test for the existence of the wikidata coordinates before attempting to display the template. See {{Infobox telescope}} for an example implementation. – Jonesey95 (talk) 11:05, 21 August 2022 (UTC)
@Valerio Bozzolan: If Wikidata doesn't have the coordinates for something and you can't manage to find them yourself, just refrain from adding any coordinate template to the article. The Anomebot2 will add a {{coord missing}} template to the article, and someone who patrols the relevant hidden categories (as I do) will eventually get around to adding them if they can be determined. Deor (talk) 14:12, 21 August 2022 (UTC)
OK. I think it could be very convenient to be able to have "universities without coordinates" in a category (instead of showing a fatal error). If this small feature is not acceptable here, no problem. I understand this point of view and another template can be made to do what I suggest. Valerio Bozzolan (talk) 19:37, 22 August 2022 (UTC)
The case for silent errors (only tracking categories) would be when coordinate is embedded in infoboxes. Those infoboxes can be spread to large amounts of articles and finding which articles have/don't have coordinates is useful without it being shown to the user as error if there yet isn't coordinate. Ipr1 (talk) 11:29, 2 February 2023 (UTC)
More concrete example might be infobox for a famous work of art, which can be indoors or outdoors, for which coordinate may be missing yet and might be added later and so on. Embedded coordinates to infoboxes would need to handle gracefully the situations where it might never have a coordinate or it might be moved (as many statues have been moved in the past). So silent tracking would be preferred in these cases. Ipr1 (talk) 12:22, 2 February 2023 (UTC)

The Template:Coord template intersects articles' infoboxes/main text on Vector 2022 (default skin)

It appears as though the position of the template, when used under the display=title parameter, is absolute and cares little about neighboring infoboxes, images, or suspected article text. This issue has far reaching implications, as seen in articles such as Andaman_Islands, Operation Rheinübung, Aegadian Islands, Arabian Sea, or even the United States articles, particularly when page width is at its slim default. The issue is mitigated when other minimal templates such as Template:Main are used, but this may be more rare than common. I request administrator help as the Module in question is Fully Protected, in addition to my inability to suggest a concrete improvement/Template:Edit fully-protected to solve this objective issue. I already have slight troubles editing Templates, but a Module is out of my expertise. I suspect it has to do with adding margin/changing the CSS display type somewhere but I'll leave the details to whomever picks this up. ZaptorZap (talk) 02:14, 28 April 2023 (UTC)

Please see #Coordinsert feature broken up above, which already discusses this problem. —TheDJ (talkcontribs) 08:46, 28 April 2023 (UTC)
Oh, my bad. Sorry for the inapproproiate use of that template. ZaptorZap (talk) 10:16, 28 April 2023 (UTC)

I've noticed this a lot in the last two days. Coincidence, or has something changed lately? Any solution that avoids the overlapping would be an improvement. @Izno and TheDJ: the list of steps to fix indicators seems reasonable, are these waiting on new people to jump in or is there pushback elsewhere? – SJ + 14:03, 29 April 2023 (UTC)

No coincidence. The sitesub header (with From wikipedia the free encyclopedia) has accidentally disappeared in last weeks' release, further aggravating this problem. —TheDJ (talkcontribs) 14:27, 29 April 2023 (UTC)
I see, didn't notice that at first. Thanks to Izno for the hackaround. We can pray for better release testing + reversion for regressions... but this seems another mark in favor of the indicator switch. – SJ + 14:40, 29 April 2023 (UTC), 02:47, 30 April 2023 (UTC)

Updating this module to use Kartographer

Please see Wikipedia:Village pump (proposals)#RfC: Updating Template:Coord to use Kartographer. Galobtter (talk) 06:24, 10 May 2023 (UTC)

Lua errors

Recent edits to this module seem to have caused Lua errors to appear at a bunch of articles, such as Ferry Point International Bridge and Calvert Marine Museum * Pppery * it has begun... 14:55, 21 May 2023 (UTC)

I think it's due to switching to use the indicator tag. If coord is just using "display=title" then Module:Mapframe isn't seeing the the geohack url to parse. You can get the same error if you just used "coordinates=x" in the infobox. The article can be fixed by changing the coord params to "display=inline,title" but the Module:Mapframe should be improved to fail more gracefully when it can't find a coord value. -- WOSlinker (talk) 15:22, 21 May 2023 (UTC)
Error handling aside, shouldn't that use case be supported? Presumably the same fix that worked for coordinsert above (which I don't fully understand) should work for this case too. * Pppery * it has begun... 18:23, 21 May 2023 (UTC)
There does seem to be a row in the infobox though with just Coordinates as a title and a blank area to the right of that if just the display=title option is used. So another option is to move the coords outside of the infobox if just the title option is desired. -- WOSlinker (talk) 18:43, 21 May 2023 (UTC)
@BrandonXLF: in case you are interested in this. * Pppery * it has begun... 18:24, 21 May 2023 (UTC)
@Pppery The error is caused by the call to frame:preprocess at Module:Mapframe#L-599, but I'm not sure why it's there in the first place. @Evad37 Do you know if it would be safe to remove the call to frame:preprocess? BrandonXLF (talk) 10:00, 22 May 2023 (UTC)

This problem appears to occur in general when the rare |display=title is used rather than the much more common |display=inline,title. I set German Museum of Technology, which uses {{Infobox museum}}, to use |display=title, and it displays the error in preview. – Jonesey95 (talk) 14:21, 23 May 2023 (UTC)

LDS temples

I wrote the following before noticing this section, I guess this is the same issue?
A recent edit has led to "Lua error in Module:Mapframe at line 384: attempt to perform arithmetic on local 'lat_d' (a nil value)" in many articles (list), for example Helsinki Finland Temple which uses {{LDS Temple/Helsinki Finland Temple}} as in:

  • {{ LDS Temple/Helsinki Finland Temple |format= Infobox LDS Temple }}

I guess the problem is that {{Infobox LDS Temple}} includes {{coord|...|display=title}}. The article is somehow pulling the coordinates from Helsinki Finland Temple (Q2603891). I'm dropping this here as a start for others to continue an investigation. Johnuniq (talk) 08:02, 22 May 2023 (UTC)

Are you sure that the article is pulling "60°13'30"N, 24°46'54"E" from Wikidata and then displaying "Coordinates: 60°13′30.69479″N 24°46′54.42599″E", the value from {{LDS Temple/Helsinki Finland Temple}}? That seems like it is not happening. Regardless, removing |display=title from {{LDS Temple/Helsinki Finland Temple}} makes the Lua error go away, but then the coordinates do not appear at the top of Helsinki Finland Temple. – Jonesey95 (talk) 14:08, 23 May 2023 (UTC)
Yes, you are right. I didn't look hard enough. Pretty weird situation but it's not really satisfactory to leave 150 articles with a big red error due to the recent change to this module. Johnuniq (talk) 03:16, 24 May 2023 (UTC)
I've fixed those. I made sure all the "Template:LDS Temple/" subpages has type:landmark in their coords params, then removed coordinsert from Template:Infobox LDS Temple and then updated those that just had display=title to also have inline. -- WOSlinker (talk) 06:38, 24 May 2023 (UTC)
Thanks. I don't know how coordinsert works but you have probably seen my comment at 05:06, 24 May 2023 below where I mention that it receives an indicator strip marker rather than coordinates. I guess that some of its usages involve coordinates being directly passed to the function, while attempts to pass what Module:Coordinates produces will now fail. Johnuniq (talk) 07:18, 24 May 2023 (UTC)