This is an archive of past discussions about Module:Coordinates. Do not edit the contents of this page. If you wish to start a new discussion or revive an old one, please do so on the current talk page.
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 me16: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)
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)
@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 me16:02, 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 me11:09, 21 September 2016 (UTC)
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)
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″N73°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″N73°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)
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 (talk • contribs) 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)
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)
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');
@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)
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:
Outdated "geo" format. They prefer hGeo now, where the class names are a lot more consistent.
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.
This edit request to Module:Coordinates has been answered. Set the |answered= parameter to no to reactivate your 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)
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)
This edit request to Module:Coordinates has been answered. Set the |answered= parameter to no to reactivate your request.
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)
Template-protected edit request on 7 August 2021 Suggestion
This edit request to Module:Coordinates has been answered. Set the |answered= parameter to no to reactivate your request.
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:
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.
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)
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)
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
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:
{{#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:
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.
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
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 (talk • contribs) 09:39, 3 July 2022 (UTC)
This edit request to Module:Coordinates has been answered. Set the |answered= parameter to no to reactivate your request.
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 talke-mail03:46, 14 September 2022 (UTC)
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.
@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: 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)
This request for help from administrators has been answered. If you need more help or have additional questions, please reapply the {{admin help}} template, or contact the responding user(s) directly on their own user talk page.
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)
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 (talk • contribs) 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)
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)
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 }}
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)