Template talk:Taginfo entry

From OpenStreetMap Wiki
Jump to navigation Jump to search

Tag combinations

Can you enhance it so that it can also show numbers for tag combinations (e.g. leisure=pitch + sport=tennis)? --Hufkratzer (talk) 22:04, 29 May 2022 (UTC)

At my level of knowledge taginfo and wiki templates I can not. I need help from a knowledgeable person. —Grass-snake (talk) 03:28, 30 May 2022 (UTC)
This template is based on Taginfo, and Taginfo doesn't return statistics for two tags used together, so what you are asking for is impossible to do. maro21 16:01, 11 February 2024 (UTC)

Adding all element icon

@Grass-snake: Thanks for creating this template, i did try to add the icon in front or behind the figures. Unfortunately i couldn't manage without line break. Could you have a look to remove the line break. thank you. --MalgiK (talk) 17:02, 3 November 2022 (UTC)

@MalgiK: Hello, should this icon be just a picture or should something happen when you click on it? — Grass-snake (talk) 18:16, 3 November 2022 (UTC)
I think for the first stage just a picture similar to . Or do you have an idea for a link target? --MalgiK (talk) 18:21, 3 November 2022 (UTC)
@MalgiK: I suppose MediaWiki:Gadget-taginfo.js returns these new lines or that's how the MediaWiki software behaves, so I guess it's impossible to fix it in CSS within the template. maro21 16:29, 11 February 2024 (UTC)

Incorrect sorting of numbers and lack of thousands separator in numbers between 1k and 10k

How can I change the template so that numbers from 1k to 10k are written in the same format as numbers greater than 10k? Currently, they do not have the thousands separator space that appears for numbers larger than 10k. Right now even table sorting isn't working properly. Example:

Value Count
government

company

telecommunication

architect

financial

newspaper

charity

private_investigator

Hi, thanks for your question, I noticed it too. Unfortunately, the same mapping occurs in the original template and I do not yet know how to fix it.

Grass-snake (talk) 17:13, 14 February 2024 (UTC)

For me Taginfo entry shows the counts correctly with separator (comma with English user interface; period with German user interface). Sorting works with English version only and with German partially if there are numbers with separator (>999) only or without separator (<1000) only. --Chris2map (talk) 20:12, 14 February 2024 (UTC)
The language/country version in which the number counts are shown (type of separators) must be equal to the page language of the wiki page in order to get mediawiki correctly interpreting and sorting the numbers: Because Taginfo2 / Taginfo-ajax (used by Taginfo entry) uses the user interface language, sorting only works for you if the page language is equal to the user interface language (set in page settings). So e.g. with German user interface only on pages set to German (the namespace DE: is not enough) sort proper. --Chris2map (talk) 20:35, 14 February 2024 (UTC)
If I understood correctly, if the Wiki page is in the PL space and the wiki is set in Polish, these numbers should work correctly. Unfortunately this is not the case. Numbers between 1k and 10k have no separator and the numbers are sorted alphabetically. Switching WIKI to the EN language causes the numbers to work correctly, but in the DE language there are similar problems as in the PL language. Example from the https://wiki.openstreetmap.org/wiki/Pl:Key:office page and a table sorted ascending by the number of uses:
Polish space and language
Numbers sorted ascending in PL
--Marek-M (talk) 06:26, 15 February 2024 (UTC)
As I wrote the page namespace (in your case Pl:) isn't sufficient. The content language in the page settings (Informacje o tej stronie) must be set to the specific language. I've changed it on your example page now. Can you try it again? --Chris2map (talk) 06:59, 15 February 2024 (UTC)
Thank you for the patch which actually improved the sorting of numbers from Taginfo to Pl:Key:office. There is still a missing thousands separator in numbers 1k-10k but that was a minor issue and I thought that was the reason for the incorrect sorting. I didn't know there was such a thing as 'page settings' but now I will try to update other pages this way myself. --Marek-M (talk) 07:16, 15 February 2024 (UTC)

add a new option to enable hyperlink

Resolved

hi, can i add a new option called |link=yes which turns the number into a hyperlink to taginfo?

This is what the code would look like:

<includeonly>
|style="text-align:right;"|<span class="taginfo-ajax" data-taginfo-key="{{{1}}}" {{#if: {{{2|}}}
 |data-taginfo-value="{{{2}}}"
}} data-taginfo-url="{{#switch: {{{region|}}}
 |de=https://taginfo.geofabrik.de/europe:germany/
 |ru=https://taginfo.geofabrik.de/russia/
 |#default=https://taginfo.openstreetmap.org
}}">{{#if: {{{link|}}}|[https://taginfo.osm.org/{{#if: {{{2|}}}|tags|keys}}/{{{1}}}{{#if: {{{2|}}}|={{{2|}}}}} }}<span class="all-count" title="taginfo – {{{1}}}={{{2|*}}}"></span>{{#if: {{{link|}}}|]}}</span></includeonly><noinclude>
{{Documentation}}
</noinclude>

to make |link=* work with |region=* we would have to repeat the {{#switch: block.

is there a process for proposing template changes, or can anyone edit it directly? --Kylenz 07:28, 11 October 2025 (UTC)

From my part, yes! There is no process that I know of aside discussing it on the talk page like here. The only thing is with the |region=*. I think "link" should be disabled if |region=* is used because the link wouldn't match.
<includeonly>
|style="text-align:right;"|<span class="taginfo-ajax" data-taginfo-key="{{{1}}}" {{#if: {{{2|}}}
 |data-taginfo-value="{{{2}}}"
}} data-taginfo-url="{{#switch: {{{region|}}}
 |de=https://taginfo.geofabrik.de/europe:germany/
 |ru=https://taginfo.geofabrik.de/russia/
 |#default=https://taginfo.openstreetmap.org
}}">
{{#if: {{{link|}}}|
  {{#if: {{{region|}}}|<span class="all-count" title="taginfo – {{{1}}}={{{2|*}}}"></span>
    |[https://taginfo.osm.org/{{#if: {{{2|}}}|tags|keys}}/{{{1}}}{{#if: {{{2|}}}|={{{2|}}}}}<span class="all-count" title="taginfo – {{{1}}}={{{2|*}}}"></span>]
  }}
  |<span class="all-count" title="taginfo – {{{1}}}={{{2|*}}}"></span>
}}
</span></includeonly><noinclude>
{{Documentation}}
</noinclude>
Just tested briefly. Needs to be double-checked again. --Chris2map (talk) 09:04, 11 October 2025 (UTC)
Thanks @Chris2map:! your version seems to work perfectly. I copied it to my sandbox and created some testcases. I see that no one else has left a comment this week, shall we wait a bit longer before updating the main template? --Kylenz 08:57, 17 October 2025 (UTC)
@Kylenz: I think we / you can go on. I did one improvement to the code to hide the external link icon so the numbers are aligned if you use different calls in a table like in your testcase; see your sandbox. --Chris2map (talk) 16:06, 17 October 2025 (UTC)
Done, thanks for all your help Chris! --Kylenz 06:46, 18 October 2025 (UTC)