Template:Ordnance Survey coordinates is permanently
protected from editing because it is a
heavily used or highly visible template. 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 template-protected}} to notify an administrator or template editor to make the requested edit. Usually, any contributor may edit the template's
documentation to add usage notes or
categories.
Any contributor may edit the template's sandbox. Functionality of the template can be checked using test cases. |
Text and/or other creative content from this version of Template:OS coord was copied or moved into Template:OS coord/sandbox with this edit on 06:34, 25 August 2015. The former page's history now serves to provide attribution for that content in the latter page, and it must not be deleted as long as the latter page exists. |
|
|
This page has archives. Sections older than 365 days may be automatically archived by Lowercase sigmabot III when more than 6 sections are present. |
Links to OS coordinates via this template currenly (2 July) are returning
Toolforge
No webservice The URI you have requested, /os/coor_g/?pagename=Swanbourne_railway_station¶ms=SP832316, is not currently serviced.
If you have reached this page from somewhere else...
This URI is part of the os tool, maintained by RHaworth .That tool might not have a web interface, or it may currently be disabled.
If you're pretty sure this shouldn't be an error, you may wish to notify the tool's maintainers (above) about the error and how you ended up here.
If you maintain this tool
You have not enabled a web service for your tool, or it has stopped working because of a fatal error. Please check the error logs of your web service.
Would someone ( RHaworth?) who knows about these things please investigate? -- John Maynard Friedman ( talk) 16:35, 2 July 2019 (UTC)
To Op47, hike395 and any one else with the skills to fix this matter.
As noted above circa 2019 April my conversion tool which this template calls stopped working. I thought it was removed because the tools.wmflabs.org server was being shut down so why is geohack still there and running? I will be delighted if someone will take over responsiblity for this tool.
Clearly, a first check to be done by someone who knows their way around wmflabs is: are the oscoor files still there but disabled? Assuming they have gone, please download rhaworth.net/tmp/oscoor.zip. In this zip:
If you have any queries please contact me - phone calls are welcomed - numbers here. — RHaworth ( talk · contribs) 19:48, 14 August 2019 (UTC)
It is probably just as easy to write in lua. I wrote in PHP because that is a language I speak and, more importantly, because that is what geohack.php is written in. You need to download oscoor.zip - don't be put off by the size of the file - 95% of it is a zip-within-a-zip that is probably of no interest. As I explain above, the only files needed are in the /os/ directory. The heart of the conversion is /os/coor_g/transversemercator.php. — RHaworth ( talk · contribs) 17:52, 15 August 2019 (UTC)
@
RHaworth and
Redrose64: Done --- IE OS grid refs now have geohack coordinates that are in the center of the grid box, rather than SW corner. Easy to revert if there are any issues. —
hike395 (
talk) 17:43, 24 August 2019 (UTC)
Locate first VERTICAL grid line to LEFT of point and read LARGE figures labelling the line ... Estimate tenths from the grid line to the pointIt's clear that if rounding had been intended, they wouldn't have stressed the word "left" but would have used wording like "Locate nearest grid line to left or right of point". See also The National Grid FAQs and the links under "Useful downloads" in the right margin. -- Redrose64 🌹 ( talk) 07:37, 25 August 2019 (UTC)
I uploaded the files to a location that they used to occupy and to my delight they worked instantly. What is needed now is:
— RHaworth ( talk · contribs) 21:31, 15 August 2019 (UTC)
@ RHaworth: Done --- I finished the Lua code today, now live at Module:OS coordinates. I have changed the template to use the Lua code, instead of calling out to RHaworth's server. This is not a big computational burden: it takes <10 milliseconds to convert from an OS grid ref to lat/long, when an article is edited.
I've left the rounding as RHaworth had it in his server code (GB = center of box, IE = SW corner of box).
Let me know if you see any problems! — hike395 ( talk) 00:17, 19 August 2019 (UTC)
The result of the move request was: pages moved: - Module:OS coordinates → Module:Ordnance Survey coordinates, Template:OS coord → Template:Ordnance Survey coordinates, based on consensus below. I've also updated the documentation, let me know if I've missed anything. ( closed by non-admin page mover) Steven Crossin Help resolve disputes! 14:07, 23 September 2019 (UTC)
– Match module name with template * Pppery * it has begun... 19:43, 25 August 2019 (UTC)
@ Hike395 and RHaworth: You've done a great job inlining this as a Lua module, and incorporating the Helmert transform -- but would it be possible to get the external service up and running again too? It was being used for Wikidata property OS grid reference (P613) on Wikidata, which can't call a template, only include the string in a URL to send to an external service.
It would be great if this could be got working again -- eg I'm just about to upload a quantity of 'official' grid references for Scottish listed buildings, and it would be nice if they could be working links rather than just strings. Jheald ( talk) 13:24, 22 November 2019 (UTC)
For some reason use of the template now brings up a 404 error on the geohack site. Can anyone help, I freely admit I'm way out of my depth on this! Murgatroyd49 ( talk) 20:01, 28 June 2020 (UTC)
region:
option: your second example has region:GB
but the first does not. Valid region codes are listed at
ISO 3166-2:GB so you could use region:GB-DEV
for Meldon Viaduct, but in practice, refining beyond GB
doesn't make a difference. --
Redrose64 🌹 (
talk) 09:40, 29 June 2020 (UTC)
a map is sometimes displayed; it does not seem to depend on the region?Which map? On which pages does this happen? -- Redrose64 🌹 ( talk) 18:32, 30 June 2020 (UTC)
This template always uses either GB or IE region codes, because OS grid refs are only defined for those two countries. The general {{ coord}} template does not.
I'm planning to change what maps this template displays -- I'm curious what other editors think. Given that this template is for an OS grid reference, it makes sense (to me) that the link click through to an Ordnance Survey map, as opposed to giving users a huge number of map choices. If they want a large number of map choices, they can click on the {{ coord}} link.
The most robust server for Ordnance Survey maps is Bing, so I was going to hardwire the Bing OS map into the URL.
Another advantage of avoid geohack is that now WikiMiniAtlas grabs all of the coordinates on a page and shows them as dots. The OS grid ref is usually close, but not identical to, the lat/long coordinates. Thus, there are now two confusing dots on the WikiMiniAtlas. Directly linking to OS maps will avoid this.
What do editors think of linking directly to OS maps? — hike395 ( talk) 21:07, 30 June 2020 (UTC)
@
SovalValtos: The template authors are trying to help you out, which may be leaving you confused. The
Sardis, S Pembrokeshire article uses {{
Infobox UK place}} which automatically injects "GB" as a region into {{
coord}}, so the region shows up in the title link and the link at the bottom of the infobox. The |os_grid_reference=
parameter internally calls {{
Ordnance Survey coordinates}}, which uses region:GB for the OS grid ref link, also. Contra RedRose, both of the links also have WikiMiniAtlas globes. —
hike395 (
talk) 05:00, 4 July 2020 (UTC)
{{
Infobox UK place}}
which includes code to inject two parameter values into {{
coord}}
. It's this block near the bottom {{#if:{{{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}})}}}}
|}}
region:IM
or region:GB
, depending upon whether |crown_dependency=
is specified or not; and (ii) either type:city
or e.g. type:city(12345)
depending upon whether |population=
is blank or not.many links in GeoHack do not work, that is something to bring up at Template talk:GeoTemplate (this is the first "Talk" link in the left sidebar of the GeoHack page), but you need to specify the article that you reached the GeoHack page from, besides the non-working links.
{{
Ordnance Survey coordinates}}
, and O.S. coordinates are not defined outside the British Isles (they're not even defined for the Channel Islands, even though the true origin for OS grid refs lies a few miles to the south of
Jersey).This
edit request to
Module:Ordnance Survey coordinates has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Hello! I'd like to add a name parameter, which adds a custom title (&title=...) to the Geohack URL.
This uses the same parameter name that is used on the Coordinates module. It's useful when the page name isn't an appropriate title and the caller wants to override it. It's also useful on pages with many grid references, where they can be mapped using the {{ GeoGroup}} template which uses the name parameters.
I've implemented it on the sandbox and added test cases, they pass and it seems to work well.
Thanks - odg ( talk) 17:25, 16 August 2020 (UTC)
|name=
and passes it along to {{
Ordnance Survey coordinates}}. Quite handy for list articles (see
List of lighthouses in Wales that I just modified).(Reposted from VPT)
Here is an extract from the table in Grade II listed buildings in the London Borough of Wandsworth:
Name | Location | Type | Completed [note 1] | Date designated |
Grid ref.
[note 2] Geo-coordinates |
Entry number [note 3] | Image |
---|---|---|---|---|---|---|---|
Wandsworth Common Windmill | Wandsworth Common | Windmill | 19th century | 7 March 1983 |
TQ2657774519 51°27′18″N 0°10′41″W / 51.455°N 0.178°W |
1183658 |
If I click on the Lat/Long coordinates, the GeoHack page gives me an OS ref of TQ2657774519, which matches the OS ref in the entry. If, however, I click on the OS ref in the entry, it gives me a GeoHack page with OS ref TQ2646474573 (51° 27′ 19.83″ N, 0° 10′ 46.59″ W) - nearby, but significantly different. Looking at the template source, this seems to be a problem with #invoke:Ordnance Survey coordinates.
Note: The EH header parameters include references to Barking and Dagenham. I think this is an old cut-and-paste error, unconnected with this problem. -- Verbarson talk edits 13:51, 15 December 2023 (UTC)
51° 27′ 19.83″ N
rounds to 51° 27′ 20″ N
).
𝕁𝕄𝔽 (
talk) 18:12, 15 December 2023 (UTC)@ Verbarson: I just updated this module in a way that may make your life much easier. I've added the inverse code (that takes lat long and produces OS grid refs, by porting my fixed PHP to Lua). What we can do is change {{ PoIgb}} to automatically generate the OS grid ref from the lat long provided, without you having to look it up manually for many cases. You just leave the fourth parameter blank for {{ PoIgb}}. I've implement this in the sandbox over there. You can see it in action at the testcases. I'm not sure which is better: should the generated OS grid ref be a map link or just a plain OS grid ref string? Either is very easy to do at this point. Which would you recommend? — hike395 ( talk) 08:19, 16 December 2023 (UTC)
subst
, because that will confuse and cause more work for other editors. Remember that Wikipedia caches pages between edits/image/template updates, so subst
does not save money when people read WP. Also, this is a microscopic amount of computation: it would take roughly 4 million edits (per module invocation) to cost Wikipedia one British pound. I think it would be better for the community if you just donate a quid to WMF. Or I can, if you like.
Template:Ordnance Survey coordinates is permanently
protected from editing because it is a
heavily used or highly visible template. 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 template-protected}} to notify an administrator or template editor to make the requested edit. Usually, any contributor may edit the template's
documentation to add usage notes or
categories.
Any contributor may edit the template's sandbox. Functionality of the template can be checked using test cases. |
Text and/or other creative content from this version of Template:OS coord was copied or moved into Template:OS coord/sandbox with this edit on 06:34, 25 August 2015. The former page's history now serves to provide attribution for that content in the latter page, and it must not be deleted as long as the latter page exists. |
|
|
This page has archives. Sections older than 365 days may be automatically archived by Lowercase sigmabot III when more than 6 sections are present. |
Links to OS coordinates via this template currenly (2 July) are returning
Toolforge
No webservice The URI you have requested, /os/coor_g/?pagename=Swanbourne_railway_station¶ms=SP832316, is not currently serviced.
If you have reached this page from somewhere else...
This URI is part of the os tool, maintained by RHaworth .That tool might not have a web interface, or it may currently be disabled.
If you're pretty sure this shouldn't be an error, you may wish to notify the tool's maintainers (above) about the error and how you ended up here.
If you maintain this tool
You have not enabled a web service for your tool, or it has stopped working because of a fatal error. Please check the error logs of your web service.
Would someone ( RHaworth?) who knows about these things please investigate? -- John Maynard Friedman ( talk) 16:35, 2 July 2019 (UTC)
To Op47, hike395 and any one else with the skills to fix this matter.
As noted above circa 2019 April my conversion tool which this template calls stopped working. I thought it was removed because the tools.wmflabs.org server was being shut down so why is geohack still there and running? I will be delighted if someone will take over responsiblity for this tool.
Clearly, a first check to be done by someone who knows their way around wmflabs is: are the oscoor files still there but disabled? Assuming they have gone, please download rhaworth.net/tmp/oscoor.zip. In this zip:
If you have any queries please contact me - phone calls are welcomed - numbers here. — RHaworth ( talk · contribs) 19:48, 14 August 2019 (UTC)
It is probably just as easy to write in lua. I wrote in PHP because that is a language I speak and, more importantly, because that is what geohack.php is written in. You need to download oscoor.zip - don't be put off by the size of the file - 95% of it is a zip-within-a-zip that is probably of no interest. As I explain above, the only files needed are in the /os/ directory. The heart of the conversion is /os/coor_g/transversemercator.php. — RHaworth ( talk · contribs) 17:52, 15 August 2019 (UTC)
@
RHaworth and
Redrose64: Done --- IE OS grid refs now have geohack coordinates that are in the center of the grid box, rather than SW corner. Easy to revert if there are any issues. —
hike395 (
talk) 17:43, 24 August 2019 (UTC)
Locate first VERTICAL grid line to LEFT of point and read LARGE figures labelling the line ... Estimate tenths from the grid line to the pointIt's clear that if rounding had been intended, they wouldn't have stressed the word "left" but would have used wording like "Locate nearest grid line to left or right of point". See also The National Grid FAQs and the links under "Useful downloads" in the right margin. -- Redrose64 🌹 ( talk) 07:37, 25 August 2019 (UTC)
I uploaded the files to a location that they used to occupy and to my delight they worked instantly. What is needed now is:
— RHaworth ( talk · contribs) 21:31, 15 August 2019 (UTC)
@ RHaworth: Done --- I finished the Lua code today, now live at Module:OS coordinates. I have changed the template to use the Lua code, instead of calling out to RHaworth's server. This is not a big computational burden: it takes <10 milliseconds to convert from an OS grid ref to lat/long, when an article is edited.
I've left the rounding as RHaworth had it in his server code (GB = center of box, IE = SW corner of box).
Let me know if you see any problems! — hike395 ( talk) 00:17, 19 August 2019 (UTC)
The result of the move request was: pages moved: - Module:OS coordinates → Module:Ordnance Survey coordinates, Template:OS coord → Template:Ordnance Survey coordinates, based on consensus below. I've also updated the documentation, let me know if I've missed anything. ( closed by non-admin page mover) Steven Crossin Help resolve disputes! 14:07, 23 September 2019 (UTC)
– Match module name with template * Pppery * it has begun... 19:43, 25 August 2019 (UTC)
@ Hike395 and RHaworth: You've done a great job inlining this as a Lua module, and incorporating the Helmert transform -- but would it be possible to get the external service up and running again too? It was being used for Wikidata property OS grid reference (P613) on Wikidata, which can't call a template, only include the string in a URL to send to an external service.
It would be great if this could be got working again -- eg I'm just about to upload a quantity of 'official' grid references for Scottish listed buildings, and it would be nice if they could be working links rather than just strings. Jheald ( talk) 13:24, 22 November 2019 (UTC)
For some reason use of the template now brings up a 404 error on the geohack site. Can anyone help, I freely admit I'm way out of my depth on this! Murgatroyd49 ( talk) 20:01, 28 June 2020 (UTC)
region:
option: your second example has region:GB
but the first does not. Valid region codes are listed at
ISO 3166-2:GB so you could use region:GB-DEV
for Meldon Viaduct, but in practice, refining beyond GB
doesn't make a difference. --
Redrose64 🌹 (
talk) 09:40, 29 June 2020 (UTC)
a map is sometimes displayed; it does not seem to depend on the region?Which map? On which pages does this happen? -- Redrose64 🌹 ( talk) 18:32, 30 June 2020 (UTC)
This template always uses either GB or IE region codes, because OS grid refs are only defined for those two countries. The general {{ coord}} template does not.
I'm planning to change what maps this template displays -- I'm curious what other editors think. Given that this template is for an OS grid reference, it makes sense (to me) that the link click through to an Ordnance Survey map, as opposed to giving users a huge number of map choices. If they want a large number of map choices, they can click on the {{ coord}} link.
The most robust server for Ordnance Survey maps is Bing, so I was going to hardwire the Bing OS map into the URL.
Another advantage of avoid geohack is that now WikiMiniAtlas grabs all of the coordinates on a page and shows them as dots. The OS grid ref is usually close, but not identical to, the lat/long coordinates. Thus, there are now two confusing dots on the WikiMiniAtlas. Directly linking to OS maps will avoid this.
What do editors think of linking directly to OS maps? — hike395 ( talk) 21:07, 30 June 2020 (UTC)
@
SovalValtos: The template authors are trying to help you out, which may be leaving you confused. The
Sardis, S Pembrokeshire article uses {{
Infobox UK place}} which automatically injects "GB" as a region into {{
coord}}, so the region shows up in the title link and the link at the bottom of the infobox. The |os_grid_reference=
parameter internally calls {{
Ordnance Survey coordinates}}, which uses region:GB for the OS grid ref link, also. Contra RedRose, both of the links also have WikiMiniAtlas globes. —
hike395 (
talk) 05:00, 4 July 2020 (UTC)
{{
Infobox UK place}}
which includes code to inject two parameter values into {{
coord}}
. It's this block near the bottom {{#if:{{{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}})}}}}
|}}
region:IM
or region:GB
, depending upon whether |crown_dependency=
is specified or not; and (ii) either type:city
or e.g. type:city(12345)
depending upon whether |population=
is blank or not.many links in GeoHack do not work, that is something to bring up at Template talk:GeoTemplate (this is the first "Talk" link in the left sidebar of the GeoHack page), but you need to specify the article that you reached the GeoHack page from, besides the non-working links.
{{
Ordnance Survey coordinates}}
, and O.S. coordinates are not defined outside the British Isles (they're not even defined for the Channel Islands, even though the true origin for OS grid refs lies a few miles to the south of
Jersey).This
edit request to
Module:Ordnance Survey coordinates has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Hello! I'd like to add a name parameter, which adds a custom title (&title=...) to the Geohack URL.
This uses the same parameter name that is used on the Coordinates module. It's useful when the page name isn't an appropriate title and the caller wants to override it. It's also useful on pages with many grid references, where they can be mapped using the {{ GeoGroup}} template which uses the name parameters.
I've implemented it on the sandbox and added test cases, they pass and it seems to work well.
Thanks - odg ( talk) 17:25, 16 August 2020 (UTC)
|name=
and passes it along to {{
Ordnance Survey coordinates}}. Quite handy for list articles (see
List of lighthouses in Wales that I just modified).(Reposted from VPT)
Here is an extract from the table in Grade II listed buildings in the London Borough of Wandsworth:
Name | Location | Type | Completed [note 1] | Date designated |
Grid ref.
[note 2] Geo-coordinates |
Entry number [note 3] | Image |
---|---|---|---|---|---|---|---|
Wandsworth Common Windmill | Wandsworth Common | Windmill | 19th century | 7 March 1983 |
TQ2657774519 51°27′18″N 0°10′41″W / 51.455°N 0.178°W |
1183658 |
If I click on the Lat/Long coordinates, the GeoHack page gives me an OS ref of TQ2657774519, which matches the OS ref in the entry. If, however, I click on the OS ref in the entry, it gives me a GeoHack page with OS ref TQ2646474573 (51° 27′ 19.83″ N, 0° 10′ 46.59″ W) - nearby, but significantly different. Looking at the template source, this seems to be a problem with #invoke:Ordnance Survey coordinates.
Note: The EH header parameters include references to Barking and Dagenham. I think this is an old cut-and-paste error, unconnected with this problem. -- Verbarson talk edits 13:51, 15 December 2023 (UTC)
51° 27′ 19.83″ N
rounds to 51° 27′ 20″ N
).
𝕁𝕄𝔽 (
talk) 18:12, 15 December 2023 (UTC)@ Verbarson: I just updated this module in a way that may make your life much easier. I've added the inverse code (that takes lat long and produces OS grid refs, by porting my fixed PHP to Lua). What we can do is change {{ PoIgb}} to automatically generate the OS grid ref from the lat long provided, without you having to look it up manually for many cases. You just leave the fourth parameter blank for {{ PoIgb}}. I've implement this in the sandbox over there. You can see it in action at the testcases. I'm not sure which is better: should the generated OS grid ref be a map link or just a plain OS grid ref string? Either is very easy to do at this point. Which would you recommend? — hike395 ( talk) 08:19, 16 December 2023 (UTC)
subst
, because that will confuse and cause more work for other editors. Remember that Wikipedia caches pages between edits/image/template updates, so subst
does not save money when people read WP. Also, this is a microscopic amount of computation: it would take roughly 4 million edits (per module invocation) to cost Wikipedia one British pound. I think it would be better for the community if you just donate a quid to WMF. Or I can, if you like.