https://geohack.toolforge.org/geohack.php?pagename=Module_talk:Coordinates¶ms=
| Module:Coordinates is indefinitely protected from editing as it is a heavily used or highly visible module. Substantial changes should first be proposed and discussed here on this page. If the proposal is uncontroversial or has been discussed and is supported by consensus, editors may use {{edit protected}} to notify an administrator to make the requested edit.
|
| This is the talk page for discussing improvements to the Coordinates module. |
|
| Archives: 1, 2, 3Auto-archiving period: 12 months |
This edit request has been answered. Set the |answered= parameter to no to reactivate your request. |
Please sync from Module:Coordinates/sandbox (diff).
This adds a class and a data-gadget attribute to the span. For now, this is a no-op change. It is intended to facilitate a more performant way of loading the WikiMiniAtlas script, when coupled with the proposed changes in MediaWiki talk:Common.js#Class-triggered gadgets. – SD0001 (talk) 14:36, 27 December 2023 (UTC)
This edit request has been answered. Set the |answered= parameter to no to reactivate your request. |
As MediaWiki now supports category-based gadget load, we can switch to that. Please sync from Module:Coordinates/sandbox (Special:Diff/1192107975/1226463973). For now, this is a no-op as the gadget isn't actually defined. – SD0001 (talk) 20:17, 30 May 2024 (UTC)
@Jonesey95 I recently found your old question on German WP. It could be because of a malformed Geohack link: "Infobox UK place" uses coordinsert which generates a broken string when "coord" got a "title" parameter: https://geohack.toolforge.org/geohack.php?pagename=Hatfield_Chase¶ms=53.528_N_0.893_W_&title=Tunnel+Pits_region:GB_type:city (see the splitted "params" seperated by the "title" parameter). "coordinsert" assumes "params" always as last parameter? Which isn't true when "title" is used. DB111 (talk) 09:10, 14 August 2024 (UTC)
Hello. Can https://en.wikipedia.org/w/index.php?title=Module:Coordinates/sandbox&oldid=1319497477 be synced to Module:Coordinates please? This should add a "level" parameter that can be set to "primary" and that defaults to "secondary", matching the behavior of the GeoData extension that this module relies on.
We currently overload "display=title" to indicate that coordinates are the primary ones. Primary in this case means which coordinates get returned for the whole page in queries such as <https://en.wikipedia.org/w/api.php?action=query&prop=coordinates&titles=Cincinnati>. I'd like greater flexibility within this template and I'd like to be more explicit about the behavior by adding this "level" parameter.
Any and all code review is welcome. The name "level" isn't great. I considered doing "display=primary" initially but that seemed worse. Level or order matches what we typically call words such as primary, secondary, or tertiary. --MZMcBride (talk) 04:40, 30 October 2025 (UTC)
{{sudo}}
Based on feedback, I switched to "precedence" in <https://en.wikipedia.org/w/index.php?title=Module:Coordinates/sandbox&oldid=1319561810>. Can this be please be reviewed for acceptance? --MZMcBride (talk) 15:34, 30 October 2025 (UTC)
|primary=yes for any primary coords on a page and |primary=no for all other (secondary) coordinates? – Jonesey95 (talk) 14:12, 2 November 2025 (UTC)
|primary=yes would be the default, as it essentially is now, so really only |primary=no would need to be used for secondary coordinates. We could also do |secondary=yes if that makes more logical sense. – Jonesey95 (talk) 20:41, 4 November 2025 (UTC)
{{coords}} on the page trying to set itself as primary by default as far as I know. --MZMcBride (talk) 01:22, 7 November 2025 (UTC)
Coordinates | |
|---|---|
| Coordinates: |
So I keep coming across pages where the |coordinates=. The issue with this is that the logic in the if statement sees that {{coords|...|display=title}}{{{coordinates}}} is not empty, and therefore renders the Coorindates: text. See the example at right, note I have used a nbsp to achieve the same result here so as not to throw random coords on the talk page title.
We should fix this somehow... The options I see include:
|display=title and if so, hiding the Coordinates: text.coordinsert functionality to change the display from just title to title and inline, though I now realize that would still require detecting what the current value of |display= is. We don't want to run into errors because the coords are defined as inline in the infobox then at the bottom of the page there is a 2nd set of coords defined for the title...Open to any suggestions! Zackmann (Talk to me/What I been doing) 23:04, 14 December 2025 (UTC)
|coordinates= to see if it wants to display the inline portion? Alternatively, can we somehow inject display=inline into the parameter, maybe with a string replacement? – Jonesey95 (talk) 01:02, 16 December 2025 (UTC)
{{Str rep|1={{coords|1|1|N|3|3|E|display=title}}|2=-hidden noexcerpt|3=}} might be fun to play with. – Jonesey95 (talk) 02:18, 17 December 2025 (UTC)
{{coord/sandbox|8|N|7|W|display=i}} → 8°N 7°W / 8°N 7°W{{#invoke:coordinates/sandbox|forceinline|{{coords|8|N|7|W|display=t}}}} → Script error: The function "forceinline" does not exist.{{{coordinates}}} param in the new function as follows: {{#invoke:coordinates|forceinline|{{{coordinates}}}}}. This would ensure that it always displays inline, in addition to in the title if that is desired. Note I have done VERY LITTLE testing of this, but am looking for feedback on this as a possible solution. Zackmann (Talk to me/What I been doing) 02:58, 19 December 2025 (UTC)
This edit request has been answered. Set the |answered= parameter to no to reactivate your request. |
Description of suggested change: To help solve the problem described at Issue with inline coords (above) I have written a new function that can be called to force coordinates to display inline. (Note: if/when implemented I will add documentation for this).
New code: please insert at Line 765
function coordinates.forceinline(frame)
local text
text = mw.ustring.gsub(frame.args[1], 'geo%-inline%-hidden', 'geo-inline')
text = mw.ustring.gsub(text, 'style=\"display:none\"', '')
return text
end
Zackmann (Talk to me/What I been doing) 19:46, 28 December 2025 (UTC)
Coordinates | |
|---|---|
![]() Interactive map of Coordinates |
Coordinates:. That is the problem I am trying to address. If you have a different/better solution, I genuinely would love it. This is just the best way I could think of to solve the issue... --Zackmann (Talk to me/What I been doing) 21:58, 1 January 2026 (UTC){{#if:{{{coordinates|}}}|other stuff}} to data29 of {{Infobox settlement}}? IIUC, the coord template expands before it gets parsed there, and so it should empty by the time it reaches this if statement. — hike395 (talk) 20:56, 11 January 2026 (UTC)
{{#if:{{#invoke:string|match|s={{{coordinates|}}}|pattern="geo-inline"|ignore_errors=true|plain=true}}|some stuff}}|coordinates= has inline coordinates. — hike395 (talk) 23:25, 11 January 2026 (UTC)
{{If inline coordinates|coordinates|if true|if false}} and that would be a general solution for use in infoboxes. 03:31, 12 January 2026 (UTC)
This edit request has been answered. Set the |answered= parameter to no to reactivate your request. |
Please copy Module:Coordinates/sandbox to Module:Coordinates. See diff for the code changes.
The function coord2text is not protected against garbage inputs. See, for example, the third-to-the-last test case for coord2text. The "expected" box is a Lua error, which happens when |type=long is applied to a junk string.
I added checks in coordinates._coord2text() to return nil if something went wrong, then checked for nil in coordinates.coord2text() and returned a blank string on failures.
The tests pass for the sandbox (except where it fixes the Lua error, above).
Thanks for your attention! — hike395 (talk) 21:04, 11 January 2026 (UTC)
Any thoughts on my edits to the sandbox that allows the module to interpret the coordinates entered single argument such as {{#invoke:Coordinates/sandbox|coord|-27.493568, 153.041787}} -> 27°29′37″S 153°02′30″E / 27.493568°S 153.041787°E or {{#invoke:Coordinates/sandbox|coord|40°26′57″N 3°43′41″W}} -> 40°26′57″N 3°43′41″W / 40.44917°N 3.72806°W instead of just spitting out an error? It would make copying and pasting coordinates from sources a lot easier and less error prone. --Ahecht (TALK
PAGE) 19:47, 24 June 2026 (UTC)
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.