Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
YYZ
Connection
HTTP/2
Language
Not provided

Ray ID: a469aba5ffaf1804

Jump to content

Template talk:WikidataCoord

Page contents not supported in other languages.
Add topic
Coordinates: Coordinates: Unable to parse latitude as a number:Q175339
From Wikipedia, the free encyclopedia
Latest comment: 8 months ago by Phuzion in topic Mostly eliminated

Strange error

[edit]

Noticed some strange error in template or module. See Statue_of_Lutgardis,_Charles_Bridge, correct coordinates from wikidata (https://tools.wmflabs.org/geohack/geohack.php?params=50.086845_N_14.4085239_E_globe:earth&language=en) are rendered wrongly (https://tools.wmflabs.org/geohack/geohack.php?pagename=Statue_of_Lutgardis,_Charles_Bridge&params=50_4_49_N_14_24_24_E_type:landmark).Jklamo (talk) 18:37, 24 June 2019 (UTC)Reply

Frietjes, could you take a look into this. In the above article, the associated entry at wikidata says the coords are 50 4 49, 14 24 24 which is the right place on the small wikimedia preview map shown in wikidata. But in the version of the article that used this template, those same coordinates are in a different location on the OSM map there.
Before I knew about this thread, I assumed the WD coords were just wrong; I found the location on google maps and put those coords (in decimal format) into the article (which located the statue correctly on the OSM map). I thought that was a good fix, but apparently there is more going on here. MB 05:24, 30 June 2019 (UTC)Reply
MB, 50°05′13″N 14°24′31″E / 50.0869°N 14.4085°E / 50.0869; 14.4085 is not what is in WD (50°4′49″N 14°24′24″E / 50.08028°N 14.40667°E / 50.08028; 14.40667). Frietjes (talk) 13:23, 30 June 2019 (UTC)Reply
Frietjes, yes, I am aware of that. But 50°4′49″N 14°24′24″E / 50.08028°N 14.40667°E / 50.08028; 14.40667 appears in a different location on the map in WD than it does here. MB 15:22, 30 June 2019 (UTC)Reply

Changing

[edit]

'coordinate parameters' are passed through to {{Coord}}. Thus we can edit 'region': such as through ISO 3166-2 code (P300), 'type': adm1st / adm2nd / adm3rd, and 'dim': "a number connected to √area (P2046)"
region is used only for adm1st / adm2nd, type is only for the three types allowed (there is no adm4th (for barangay), but dim: is used for every place (with a positive area).

'template parameters' are passed through to {{Coord}} no problem.

Thus for

{{WikidataCoord||{{safesubst:#switch:{{safesubst:#invoke:string|replace|{{safesubst:#invoke:WikidataIB |getValue |P31||fwd=ALL|rank=b |osd=no |noicon=true|linked=false}}|, {{safesubst:label|Q1549591}}|replace=}}
 | municipality of the Philippines
 | city of the Philippines
 | highly urbanized city = type:adm3rd_
 | barangay =
 | province of the Philippines = region:{{safesubst:#invoke:WikidataIB |getValue |P300||fwd=ALL |rank=b |osd=no |noicon=true |linked=false}}_type:adm2nd_
 | region of the Philippines = region:{{safesubst:#invoke:WikidataIB |getValue |P300||fwd=ALL |rank=b |osd=no |noicon=true |linked=false}}_type:adm1st_
 }}dim:{{PH wikidata/power|{{PH wikidata/sqrt|{{convert|{{safesubst:#invoke:WikidataIB |getValue |P2046|qid=Q13669|fwd=ALL|rank=b|osd=no|noicon=true|su=false}}|km|km|2|disp=output number only|comma=off}}}}}}000|format=dms|display=it}}

1a dim:1000|format=dms|display=i}}

1b Coordinates: Unable to parse latitude as a number:Q4708210
Invalid arguments have been passed to the {{#coordinates:}} function Alang-alang, Mandaue is fourth order
https://geohack.toolforge.org/geohack.php?pagename=Template_talk:WikidataCoord&params=10_19_55_N_123_57_13_E__dim:1000
Well that's OK, and when it gets to GeoHack it's the same too.

2a type:adm3rd_dim:4000|format=dms|display=i}}

2b Coordinates: Unable to parse latitude as a number:Q315703
Invalid arguments have been passed to the {{#coordinates:}} function Argao is third order
https://geohack.toolforge.org/geohack.php?pagename=Template_talk:WikidataCoord&params=9_53_N_123_36_E_
There are no coordinate parameters at all

3a region:PH-SIG_type:adm2nd_dim:8000|format=dms|display=i}}

3b Coordinates: Unable to parse latitude as a number:Q13879
Invalid arguments have been passed to the {{#coordinates:}} function Siquijor is second order
https://geohack.toolforge.org/geohack.php?pagename=Template_talk:WikidataCoord&params=9_11_N_123_34_E_
There are no coordinate parameters at all

4a region:PH-07_type:adm1st_dim:16000|format=dms|display=i}}

4b Coordinates: Unable to parse latitude as a number:Q13669
Invalid arguments have been passed to the {{#coordinates:}} function Central Visayas is first order
https://geohack.toolforge.org/geohack.php?pagename=Template_talk:WikidataCoord&params=10_0_N_123_30_E_
There are no coordinate parameters at all

Try with region=no and type=yes:

2c Coordinates: Unable to parse latitude as a number:Q315703
Invalid arguments have been passed to the {{#coordinates:}} function
https://geohack.toolforge.org/geohack.php?pagename=Template_talk:WikidataCoord&params=9_53_N_123_36_E_

Try with region=yes and type=no:

2e Coordinates: Unable to parse latitude as a number:Q315703
Invalid arguments have been passed to the {{#coordinates:}} function
https://geohack.toolforge.org/geohack.php?pagename=Template_talk:WikidataCoord&params=9_53_N_123_36_E_

Try with both region=no and type=no:

2f Coordinates: Unable to parse latitude as a number:Q315703
Invalid arguments have been passed to the {{#coordinates:}} function
https://geohack.toolforge.org/geohack.php?pagename=Template_talk:WikidataCoord&params=9_53_N_123_36_E_
That doesn't work either! Now I guess that means that GeoHack doesn't work because the coordinates in wikidata are only dm not dms. Now to try that, if I can.

So I change the wikidata coordinate to have arcseconds to:
4c https://geohack.toolforge.org/geohack.php?pagename=Template_talk:WikidataCoord&params=10_0_0_N_123_30_0_E_region:PH-07_type:adm1st_dim:1000000

At last I worked what is wrong and what is to be done. But I can't do it – wikidataCoord, GeoHack and Wikidata between them have to agree what is to be done.
(It is a bit confused, as I had to change a couple of coordinate, and that means the older coordinates have been wiped.) Maybe I'll send this to Village pump.

Overprecise Records of wikidata

[edit]

In Flaminio Obelisk another user replaced my {{WikidataCoord}} with {{coord}} saying "adding coord to replace overprecise Wikidata coords". Why are wikidata coords overprecise? Why does it matter? I just wanted to use the database wikidata instead of adding the coords again manually for OSM.Ruedi33a (talk) 17:21, 8 October 2021 (UTC)Reply

Explained in WP:OPCOORD. MB 18:26, 8 October 2021 (UTC)Reply
Not the fault of the template. {{WikidataCoord}} merely renders the coordinates that are stored at Wikidata:
the raw information from wikidata:
{{#property:P625|from=Q568194}} → 41°54'38.52"N, 12°28'34.86"E
and the rendered output of {{WikidataCoord}}:
{{WikidataCoord|Q568194|display=}} → Coordinates: Missing latitude
Invalid arguments have been passed to the {{#coordinates:}} function
—Trappist the monk (talk) 18:35, 8 October 2021 (UTC)Reply

Template:WikidataCoord and Category:Coordinates_on_Wikidata

[edit]

Please check Wikipedia:Village_pump_(technical)#Template:WikidataCoord_and_Category:Coordinates_on_Wikidata. --Tim Wu (talk) 15:49, 14 May 2022 (UTC)Reply

Error

[edit]

Used on Villa Park (in preview; I did not save), the markup:

{{WikidataCoord|type:landmark_region:GB |display=inline,title}}

generates an error: {{WikidataCoord}} – malformed coordinate data.

What's up? Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 14:43, 12 June 2023 (UTC)Reply

That error message occurs because {{{1}}} is assigned the value type:landmark_region:GB which is not a QID so the call into wikidata returns nothing and nothing is not valid coordinate data. Rewriting the template to include the QID works:
{{WikidataCoord|Q175339|type:landmark_region:GB |display=inline,title}}
Coordinates: Unable to parse latitude as a number:Q175339
Invalid arguments have been passed to the {{#coordinates:}} function
See the template documentation...
—Trappist the monk (talk) 15:27, 12 June 2023 (UTC)Reply

Which template to prefer?

[edit]

Should I prefer WikidataCoord over Coord? I would have expected "yes, one source of truth", but in the description of the template I read "This template does not display in the mobile view of Wikipedia ..." and "to make the coordinates visible for mobile users, one would use ..." which confuses me. PhiRho~dewiki (talk) 10:48, 9 March 2025 (UTC)Reply

P159?

[edit]

I just encountered a few articles linking to WD QIDs that had d:Property:P159 enveloping d:Property:P625. The calls from this template currently produce errors in such a case.

Can we support that here? --Joy (talk) 20:45, 28 October 2025 (UTC)Reply

{{WikidataCoord hqlocation}} doesn't work for you?
—Trappist the monk (talk) 21:57, 28 October 2025 (UTC)Reply
Oh, I didn't see that, thanks. Does it have to be a separate template, can we autodetect this cheaply enough somehow? --Joy (talk) 22:10, 28 October 2025 (UTC)Reply
We could rewrite {{WikidataCoord}} and Module:WikidataCoord to do that but is it worth the effort? A rewrite would likely require changes to the template, to the module, to the documentation, to all instances of the template wherever it is used, a WP:TFD for {{WikidataCoord hqlocation}}. Seems a lot of work for a comparatively small number of templates (~13600 {{WikidataCoord}} templates v. ~25 {{WikidataCoord hqlocation}} templates).
—Trappist the monk (talk) 14:02, 29 October 2025 (UTC)Reply

Coord vs WikidataCoord

[edit]

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


Can someone help me understand this? I have found that {{Coord|display=it}} seems to produce the same result as {{WikidataCoords|display=it}} on multiple different pages... Is there some difference between these 2 templates that I am missing? Zackmann (Talk to me/What I been doing) 23:51, 12 December 2025 (UTC)Reply

For the record, I am considering a TFD merger of the two and want to make sure I am not missing something. Other posts (see Template talk:Coord § Coord vs WikidataCoord) and questions of this have not properly addressed my concern so want to make sure I do my WP:BEFORE, before I nominate this. Zackmann (Talk to me/What I been doing) 00:26, 13 December 2025 (UTC)Reply
I have given an answer at the other discussion. One discussion in one place please. See WP:MULTI. You should, as I did, close this discussion or close the other.
—Trappist the monk (talk) 00:43, 13 December 2025 (UTC)Reply
The discussion above is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.

Mostly eliminated

[edit]

My bot run to convert from {{WikidataCoord}} to {{Coord}} has been successful, and I have gotten rid of almost all of the remaining instances of this template in articlespace. There are currently two outstanding issues: First, {{Infobox archives}} needs to be updated to use {{Coord}} instead of {{WikidataCoord}}. Second, there is an outstanding bug with Dooley's Ferry Fortifications Historic District, where the coordinates are not rendering properly when using {{Coord}}, but they are rendering fine with {{WikidataCoord}}. If someone more adept at template editing could take a look at the Infobox archives issue, I'd appreciate it.

Additionally, there are about 100 non-articlespace uses of the template that should probably be tidied up. phuzion (talk) 18:05, 19 January 2026 (UTC)Reply

@Phuzion: GREAT WORK!!! Frietjes took care of the first and I figured out the second (it was an issue with the WikiData value). So now the question becomes what to do with the non-articles space uses...
I can take care of those! --Zackmann (Talk to me/What I been doing) 03:37, 20 January 2026 (UTC)Reply
Thanks! You did the vast majority of the work with writing the substitution template. All I did was the BRFA paperwork and a little cleanup here and there as the bot ran.
Glad to see that this merge is going pretty quickly and easily. As always, let me know if you can think of any other TFD’s to process! phuzion (talk) 03:43, 20 January 2026 (UTC)Reply