| Module:Coordinates is permanently 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 |
| Related pages |
|---|
Interface-protected edit request 27 December 2023
[edit]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)
coordinsert problem?
[edit]@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)
Add a "precedence" parameter
[edit]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)
- It's a bit unfortunate choice of the parameter name. In this context, I thought level has something to do with altitude. How about "importance level", prominence, significance, priority, relevance, precedence, or primacy? 98.15.131.172 (talk) 09:26, 30 October 2025 (UTC)
- Precedence may be better, yeah. --MZMcBride (talk) 15:31, 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)
- Should the {{#coordinates:}} not be included if the params are |display=title|precedence=secondary ? As precedence is currently ignored if display has title, or would then never be a case with the title coord not being the primary? -- WOSlinker (talk) 18:18, 30 October 2025 (UTC)
- Oh, good point. I believe this is now addressed in <https://en.wikipedia.org/w/index.php?title=Module:Coordinates/sandbox&oldid=1319669517>. --MZMcBride (talk) 05:15, 31 October 2025 (UTC)
- @MZMcBride: Did a little testing and didn't seem to work all the time, so made some changes. Did the check for display=title and precedence=secondary first and also set the value to blank rather than secondary that gets passed over to #coordinates as it didn't seem to accept secondary. Can you check that it looks ok with my changes? -- WOSlinker (talk) 08:49, 31 October 2025 (UTC)
- I like precedence better than level, but are we overspecifying this, making it easier to make typos and other errors? What if we just had
|primary=yesfor any primary coords on a page and|primary=nofor all other (secondary) coordinates? – Jonesey95 (talk) 14:12, 2 November 2025 (UTC)- Yeah, this might be a lot cleaner and clearer. --MZMcBride (talk) 18:55, 3 November 2025 (UTC)
- I meant to say, in case it is not implied:
|primary=yeswould be the default, as it essentially is now, so really only|primary=nowould need to be used for secondary coordinates. We could also do|secondary=yesif that makes more logical sense. – Jonesey95 (talk) 20:41, 4 November 2025 (UTC)- We currently set coords to secondary by default and only to primary if display=title is set. I'm trying to add functionality so that we can set primary coords without needing to overload display=title. We do not want every
{{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)- Indeed. I either didn't know that or had forgotten. Carry on. – Jonesey95 (talk) 13:23, 7 November 2025 (UTC)
- We currently set coords to secondary by default and only to primary if display=title is set. I'm trying to add functionality so that we can set primary coords without needing to overload display=title. We do not want every
- I meant to say, in case it is not implied:
- Yeah, this might be a lot cleaner and clearer. --MZMcBride (talk) 18:55, 3 November 2025 (UTC)
- I like precedence better than level, but are we overspecifying this, making it easier to make typos and other errors? What if we just had
- @MZMcBride: Did a little testing and didn't seem to work all the time, so made some changes. Did the check for display=title and precedence=secondary first and also set the value to blank rather than secondary that gets passed over to #coordinates as it didn't seem to accept secondary. Can you check that it looks ok with my changes? -- WOSlinker (talk) 08:49, 31 October 2025 (UTC)
- Oh, good point. I believe this is now addressed in <https://en.wikipedia.org/w/index.php?title=Module:Coordinates/sandbox&oldid=1319669517>. --MZMcBride (talk) 05:15, 31 October 2025 (UTC)
Issue with inline coords
[edit]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:
- Detecting if
|display=titleand if so, hiding theCoordinates:text. - Somehow modifying Module:coordinates so that in certain circumstances you can use the
coordinsertfunctionality 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)
- @Jonesey95 and Hike395: any thoughts on this? Zackmann (Talk to me/What I been doing) 18:40, 15 December 2025 (UTC)
- Looks like the coordinates module already has some helper functions that parse the display parameter value, so maybe just make sure they are exported in a namespace from which they can be reused? --Joy (talk) 19:42, 15 December 2025 (UTC)
- Not sure how exactly that would look. I'm only able to picture an additional function that would return the a parsed display parameter. Zackmann (Talk to me/What I been doing) 22:33, 15 December 2025 (UTC)
- Can we test the output of
|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)- Exactly what I am thinking, just not really sure how to do that... Happy to dive into it though. Mainly wanted to sanity check that I wasn't missing something obvious before I went down the rabbit hole. Zackmann (Talk to me/What I been doing) 01:04, 16 December 2025 (UTC)
- This is a total hack and will definitely have negative side effects (I think), but
{{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)- Because there's no mention of 'display' or 'inline' or 'title' in the second or third parameters, nobody will remember what it does tomorrow. Let's not make it more complex and less likely to be maintained. --Joy (talk) 08:19, 17 December 2025 (UTC)
- This is a total hack and will definitely have negative side effects (I think), but
- Exactly what I am thinking, just not really sure how to do that... Happy to dive into it though. Mainly wanted to sanity check that I wasn't missing something obvious before I went down the rabbit hole. Zackmann (Talk to me/What I been doing) 01:04, 16 December 2025 (UTC)
- I'm referring to isInline() and similar functions, Module:Coordinates#L-633. With a few relatively small interventions, this could be brought out of the local scope and we could conceivably use it to quickly check the display value from the outside. --Joy (talk) 08:47, 16 December 2025 (UTC)
- Hmm that could certainly help! I'll get into this later this week and see if I can't mock something up in the Sandbox. Zackmann (Talk to me/What I been doing) 16:46, 16 December 2025 (UTC)
- @Joy and Jonesey95: moved the discussion here where I probably should have started it. I have mocked up a solution in Module:Coordinates/sandbox. See below:
{{coord/sandbox|8|N|7|W|display=i}}→ 8°N 7°W / 8°N 7°W{{#invoke:coordinates/sandbox|forceinline|→ 8°N 7°W / 8°N 7°W / 8; -7{{coords|8|N|7|W|display=t}}}}
- So with this we could wrap {{Infobox settlement}}'s
{{{coordinates}}}param in the new function as follows:{{#invoke:coordinates|forceinline|. 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){{{coordinates}}}}}- @Pppery, Izno, Hike395, and Frietjes: as recent editors of this template, at your convenience, could you please review the above discussion and my attempted solution? Thanks!
Zackmann (Talk to me/What I been doing) 19:13, 22 December 2025 (UTC)
- @Pppery, Izno, Hike395, and Frietjes: as recent editors of this template, at your convenience, could you please review the above discussion and my attempted solution? Thanks!
- @Joy and Jonesey95: moved the discussion here where I probably should have started it. I have mocked up a solution in Module:Coordinates/sandbox. See below:
- Hmm that could certainly help! I'll get into this later this week and see if I can't mock something up in the Sandbox. Zackmann (Talk to me/What I been doing) 16:46, 16 December 2025 (UTC)
- Can we test the output of
- Not sure how exactly that would look. I'm only able to picture an additional function that would return the a parsed display parameter. Zackmann (Talk to me/What I been doing) 22:33, 15 December 2025 (UTC)
Edit request 28 December 2025
[edit]| It is requested that an edit be made to the fully protected module at Module:Coordinates. (edit · history · last · links · sandbox · edit sandbox · sandbox history · sandbox last edit · sandbox diff · test cases · transclusion count · protection log) This template must be followed by a complete and specific description of the request, so that an editor unfamiliar with the subject matter could complete the requested edit immediately.
Edit requests to fully protected pages should only be used for edits that are either uncontroversial or supported by consensus. If the proposed edit might be controversial, discuss it on the protected page's talk page before using this template. Consider making changes first to the module's sandbox and test them thoroughly here before submitting an edit request. To request that a page be protected or unprotected, make a protection request. When the request has been completed or denied, please add the |
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)