Template talk:OSM Location map
Add topic| This is the talk page for discussing improvements to the OSM Location map template. |
|
| Archives: 1, 2Auto-archiving period: 12 months |
| This template does not require a rating on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||
| ||||||||
| Template:OSM Location map is indefinitely protected from editing as 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. |
Would it be possible to adjust the color of the number on each dot?
[edit]There is a map I'm working on where it would be helpful to have some of the dots enumerated (and given captions) but not others. I was hoping that I could change the color of the number to match the color of the dot so it would "disappear", but I don't believe this is possible to do. LivinAWestLife (talk) 10:14, 1 July 2025 (UTC)
- Always link to an example page when reporting an issue. – Jonesey95 (talk) 17:31, 1 July 2025 (UTC)
- If the default shape has been set as 'n-circle', then any (lets say set 3) that shouldn't have a number can be set to 'shape3=circle', and it will have neither a number nor a caption entry. You may then want to use label3= to indicate what the dot represents, or the main caption could explain what the unnumbered dots are. RobinLeicester (talk) 17:41, 3 July 2025 (UTC)
- Thanks, that's quite helpful. LivinAWestLife (talk) 18:37, 8 August 2025 (UTC)
New OSM Location map only showing useFormatStyle
[edit]In the past when making these maps, there would be boxes for coords, labels, marks, label colors, etc. now I only see useFormatStyle. What does that mean? How do I make a map with coordinates? AnthonyBurnett25 (talk) 15:12, 12 July 2025 (UTC)
- Are you referring to another mapping application aid, perhaps one in Wikipedia:Maps for Wikipedia. Few are as useful now as {{OSM Location map}} which has many ways of making maps with known coordinates as individual marks, geolines or geoshapes with examples linked to in the documentation, but there is a learning curve, best done in your personal sandbox, based on modifying working code. ChaseKiwi (talk) 20:59, 12 July 2025 (UTC)
- No, I'm referring to OSM Location Map. When I open the template to edit the only box is "useFormatStyle". There's no way to make marks, geolines etc. I had no issues making these back at the beginning of the year. Idk if it's because I don't use EditSource as I find it quite confusing and the normal edit works fine for what I need to do. AnthonyBurnett25 (talk) 14:55, 13 July 2025 (UTC)
- Sorry, I always use edit source now as too many pages I am interested in have visual editor disabled. However the parameter documentation needed for visual editing has presumably got mucked up in the transition to the new underlying Lua module and this is not solvable by me. ChaseKiwi (talk) 20:55, 13 July 2025 (UTC)
- The documentation should be enhanced to support Wikipedia:TemplateData. This enhancement will assist VisualEditor users. Since there are many available parameters, I suggest starting with the basics like coordinates and labels. I'm willing to give this a try. Has anyone started to do this? DutchTreat (talk) 10:13, 16 July 2025 (UTC)
- No one will have done this and I do not have the skill set to help. A point I will make. Users faced with such should completely clear their browser wikipedia associated cookie cache as the parameter change on conversion to the Lua solution could have completely mucked up visual editor assumptions. Can user:AnthonyBurnett25 confirm he has done this. I have now found I had to do this to get back to the working source editing interface I prefer, when I tried to understand the issue... yet another reason to stay away from visual editing for me. ChaseKiwi (talk) 11:07, 16 July 2025 (UTC)
- I have created an empty TemplateData section. Someone can start the actual TemplateData. I recommend copying and pasting from another template's documentation, then copying in the text, as appropriate, from the "Blank code with comments" box on this page. That should provide a basic TD interface for editors. – Jonesey95 (talk) 17:28, 19 July 2025 (UTC)
- Sorry for not noticing this discussion earlier – the /doc subpage was on my watchlist, but the main template page wasn’t. (Jonesey95, we can avoid such unnecessary revert cycles if you link to the discussion right in your first edit next time.)
- I think the best way to edit TemplateData, especially for beginners, is to use the wizard that can be opened with the Edit template data button, and then cut&pasting the result wherever you want to put it if it ends up at the wrong place. (The wizard even suggests automatically adding all recognized parameters, but that’s of limited use in this case, since the problem is exactly that parameters aren’t recognized. And this is not a cache issue as ChaseKiwi suggests, but the result of the fact that parameters are accessed from Lua in a way that’s practically impossible for TemplateData to track down.) Note that some of the types are not obvious (what exactly
booleanmeans, which values are accepted fornumberetc.), it’s best to consult the official documentation. - I still hold that adding the banner without actual documentation, even for the time being, is more confusing than useful, but I don’t want to get into an edit war, especially if this “time being” is short enough. —Tacsipacsi (talk) 21:03, 19 July 2025 (UTC)
- I have created an empty TemplateData section. Someone can start the actual TemplateData. I recommend copying and pasting from another template's documentation, then copying in the text, as appropriate, from the "Blank code with comments" box on this page. That should provide a basic TD interface for editors. – Jonesey95 (talk) 17:28, 19 July 2025 (UTC)
- No one will have done this and I do not have the skill set to help. A point I will make. Users faced with such should completely clear their browser wikipedia associated cookie cache as the parameter change on conversion to the Lua solution could have completely mucked up visual editor assumptions. Can user:AnthonyBurnett25 confirm he has done this. I have now found I had to do this to get back to the working source editing interface I prefer, when I tried to understand the issue... yet another reason to stay away from visual editing for me. ChaseKiwi (talk) 11:07, 16 July 2025 (UTC)
- The documentation should be enhanced to support Wikipedia:TemplateData. This enhancement will assist VisualEditor users. Since there are many available parameters, I suggest starting with the basics like coordinates and labels. I'm willing to give this a try. Has anyone started to do this? DutchTreat (talk) 10:13, 16 July 2025 (UTC)
- Sorry, I always use edit source now as too many pages I am interested in have visual editor disabled. However the parameter documentation needed for visual editing has presumably got mucked up in the transition to the new underlying Lua module and this is not solvable by me. ChaseKiwi (talk) 20:55, 13 July 2025 (UTC)
- No, I'm referring to OSM Location Map. When I open the template to edit the only box is "useFormatStyle". There's no way to make marks, geolines etc. I had no issues making these back at the beginning of the year. Idk if it's because I don't use EditSource as I find it quite confusing and the normal edit works fine for what I need to do. AnthonyBurnett25 (talk) 14:55, 13 July 2025 (UTC)
- Holidays (and zero experience with visual editing) meant I couldn't follow up the useful discussions above until now. I have added a starter selection of TemplateData parameters to enable a base map and a first marker with label plus a selection of options. Hopefully this will at least give a way in for visual editors. I think it will always need manual editing to make good use of multiple marks and the more obscure possibilities. Feedback on how much of the possible need this meets would be useful. (What it really wants is a full-blown map-based graphics editor - but don't hold your breath on that one). RobinLeicester (talk) 20:53, 9 August 2025 (UTC)
Bug: incorrect marker position
[edit]Just to inform that I started a discussion about this on the module talk page discussion. Fernando Trebien (talk) 04:34, 6 August 2025 (UTC)
- The issue was primarily affecting dot positions near the edges of southern hemisphere maps. Now fixed in the lua module, but please post details if you are here to say there is unexpected repositioning of marks/dots. RobinLeicester (talk) 15:55, 11 August 2025 (UTC)
Avoiding a malformed coordinates error
[edit]Is there any way I can get the "Tahiti United" label and mark to appear in this {{OSM Location map}} (right) other than setting {{Coord}}'s longitude to 210.5101 and triggering Category:Pages with malformed coordinate tags? A fellow editor at Talk:OFC Professional League diagnosed the problem as, "the map, centered on an east longitude, can't deal with a point having a west longitude,
" — AFC Vixen 🦊 19:56, 29 August 2025 (UTC)
- I see user:Deor has come alone and unhelpfully without comment here in talk rewritten the code that was used to generate the error probably to remove the error notification. ChaseKiwi (talk) 18:16, 30 August 2025 (UTC)
- Like the second one? – Jonesey95 (talk) 04:17, 30 August 2025 (UTC)
- This looks likely to be a very old issue (bug) with OSM maps. See phabricator:polygon reaching over meridian 180° gets cut off on large map. I have got around by using switching logic etc. ChaseKiwi (talk) 07:48, 30 August 2025 (UTC)
- I have confirmed on zoom out its just a variant of well known bug so you can probably program around it. ChaseKiwi (talk) 07:58, 30 August 2025 (UTC)....I have added code that does not generate malformed coordinate error on third version of map if you comment out the two other versions that do. ChaseKiwi (talk) 08:09, 30 August 2025 (UTC)
- user:AFC Vixen, I'm a bit late to the party with this, but there is a parameter,
dateline1=1that will use the 'normal' longitude value but shift it to the correct hemisphere. I have edited example1 to show this, with the map still centered west of the dateline and the dot to the east. You can use -1 where the opposite it required (and number the dateline parameter to match whichever dots need to be shifted). RobinLeicester (talk) 21:50, 10 September 2025 (UTC)
- user:AFC Vixen, I'm a bit late to the party with this, but there is a parameter,
Testcases
[edit]The clean up of a number of old documentation pages has removed a number of useful test cases which had code that inexperienced users of this complex template could learn from. I suggest that a test cases page be created to which I can contribute some raw json examples and a few templates. ChaseKiwi (talk) 17:08, 1 September 2025 (UTC)
- ChaseKiwi The deletion process was a bit abrupt, but of itself probably made sense. However I have recreated one of your raw json maps on the Template:OSM Location map/examples page (and linked to it from the relevant documentation section). Extra text/info on the topic would be an improvement, and links to articles with such maps would definitely be a big help.
- RobinLeicester Had noted and will see if I can add something useful on raw json ChaseKiwi (talk) 11:30, 13 September 2025 (UTC)
- ChaseKiwi The deletion process was a bit abrupt, but of itself probably made sense. However I have recreated one of your raw json maps on the Template:OSM Location map/examples page (and linked to it from the relevant documentation section). Extra text/info on the topic would be an improvement, and links to articles with such maps would definitely be a big help.
Automatizing population maps
[edit]Hello! I have started testing this template to create population maps with varying dot sizes according to population. I have prepared to take the information of coordinates, population of the place and overall population of the map (so the dots can be sized according to the global population shown) from Wikidata. You can see an example here (Basque Wikipedia). I was trying to find if this could be further automated, directly using template variables for inclusion (is to say, using |place1= Qxxxxx), but I can't do it, because it needs some {{#if: coding and it seems that those parser functions are solved after the template and the module is generated.
Another solution could be loading places from a wdqs query, but I doubt I can size the dot using that.
If anyone can suggest a way to further automate this, it would be a great use example of the template. Thanks! Theklan (talk) 14:52, 26 December 2025 (UTC)
- Interesting concept which would be generally useful for expressing other comparative data such as GNP. As no editorial rights on Basque Wikipedia can not see your code so can not help unless you put an example of your code in say your en wikipedia sandbox. ChaseKiwi (talk) 16:26, 26 December 2025 (UTC)
- Thanks! I have copied the raw code here: User:Theklan/sandbox Theklan (talk) 08:53, 27 December 2025 (UTC)
- Code does not work on en:Wikipedia - once working, (I think there is more than replacing koord and Wikibase) you might considered if say Module:WikidataIB is safer for the general case in case your template should go in infoboxs willing to have a further look although others will need to help as I think you will have to do it in Lua.
- Yes, I know that it doesn't work at enwiki. euwiki has a way more effective Wikidata module, that allows us easy automation of lot of templates. My idea was about simplifying it, but it is still complex, as many labels need specific positioning, and this can't be automatized. -Theklan (talk) 20:58, 27 December 2025 (UTC)
- Thanks so can't help directly but will try your code with {{Wikidatacoord}} as its an interesting idea. ChaseKiwi (talk) 09:01, 28 December 2025 (UTC)
- Just a note that seem to have got working mapping code with sized circles using en:Wikipedia modules so will explore your request and may end up with something useful whatever for en:Wikipedia ChaseKiwi (talk) 10:04, 28 December 2025 (UTC)
- I have added an en:Wikipedia version of your map so others can look at code and perhaps answer your request.ChaseKiwi (talk) 13:12, 28 December 2025 (UTC)
- I have become aware of a week old consensus that {{Wikidatacoord}} will be replaced by {{coord}} as per TFD so have updated code which gets even more concise. I also noted that there were insufficient settlements (as population census subareas) in the Arakil municipality to do more automation of data pulling ChaseKiwi (talk) 17:49, 28 December 2025 (UTC).
- Looks like a great use-case. One approach would be to move all the wikidata invokes inside the Lua module. Each settlement could use a new numbered parameter, eg settlement-data3 etc to supply the Q value for the settlement. It could then auto-populate the coords (avoiding use of any coord templates), size, label names, images, descriptions etc from wikidata Pvalues. The other values (color, shape, label-pos, etc) could use defaults set within the local template, which could still be overidden (as could the auto-populated parameters) for each settlement dot in the same way it currently works. I can give that a try over the next few days if that looks like the right approach. (it might need a user-provided or auto-adjusting size scale value to get the right range of sizes, which ideally would then have a legend item of some sort to show size values, but that could be phase 2...) RobinLeicester (talk) 22:26, 28 December 2025 (UTC)
- I have become aware of a week old consensus that {{Wikidatacoord}} will be replaced by {{coord}} as per TFD so have updated code which gets even more concise. I also noted that there were insufficient settlements (as population census subareas) in the Arakil municipality to do more automation of data pulling ChaseKiwi (talk) 17:49, 28 December 2025 (UTC).
- I have added an en:Wikipedia version of your map so others can look at code and perhaps answer your request.ChaseKiwi (talk) 13:12, 28 December 2025 (UTC)
- Just a note that seem to have got working mapping code with sized circles using en:Wikipedia modules so will explore your request and may end up with something useful whatever for en:Wikipedia ChaseKiwi (talk) 10:04, 28 December 2025 (UTC)
- Code does not work on en:Wikipedia - once working, (I think there is more than replacing koord and Wikibase) you might considered if say Module:WikidataIB is safer for the general case in case your template should go in infoboxs willing to have a further look although others will need to help as I think you will have to do it in Lua.
- Thanks! I have copied the raw code here: User:Theklan/sandbox Theklan (talk) 08:53, 27 December 2025 (UTC)

1.2miles
(5)
(136)
(114)
(67)
Total Arakil population (wikidata:Q1753006) = 990 (2025 register office)
| No. | Arakil | population | year | Wikidata page |
|---|---|---|---|---|
1 | Izurdiaga | 178 | 2020 | Q3156510 |
2 | Etxarren | 157 | 2020 | Q3059419 |
3 | Yábar | 136 | 2020 | Q3148356 |
4 | Hiriberri Arakil | 114 | 2020 | Q3136229 |
5 | Eguiarreta | 77 | 2020 | Q3049179 |
6 | Errotz | 67 | 2020 | Q3057492 |
7 | Etxeberri | 60 | 2020 | Q3059425 |
8 | Satrustegi | 53 | 2020 | Q3473998 |
9 | Zuhatzu | 42 | 2020 | Q3576238 |
10 | Ekai | 34 | 2020 | Q3049559 |
11 | Aizkorbe | 20 | 2020 | Q5391015 |
12 | Urritzola | 19 | 2020 | Q3552462 |
13 | Murgindueta | 5 | 2020 | Q12263903 |
14 | Itsasperri | not found | 2023 | Q12259883 |
- Hi Theklan, Here is what I now have on the sandbox module. The end result looks much the same, but now each settlement just needs its Qvalue, and gets a population-sized dot, plus label, tooltip and fullscreen-extras. As you said, getting the label-pos right is not likely to work with only automatic values, but does allow any level of customising on the settlement dots and any other dot features. It uses the 'municipality' Qvalue to get the total population. Does this take your idea forward? It should work on any wiki with mw.wikibase available. I believe it will bring in the names etc in the language of the calling wiki, but it would be nice to confirm that at some point. I will need to do more checks both for this feature, and any unintended consequences, so if you spot anything untoward, please let me know. RobinLeicester (talk) 21:14, 29 December 2025 (UTC)
- Wow! A lot of movement happened in the last day! I have been busy at work and I found this... which looks really nice and I think easier to use than my heavy code. I'll take a look these days, but it looks very promising. I see that for Ekai, there's a yellow label, maybe because it points to a disambiguation page instead of the real one. Theklan (talk) 21:44, 29 December 2025 (UTC)
- I see two problems now. First, the link and the label can be different things, so both should be loaded. The other one is that the image in the large maps are shown full width. -Theklan (talk) 08:35, 30 December 2025 (UTC)
- Yes the image problem is a bug likely specific to wikidata downloaded images that I was not able to address using templates as its almost certainly only addressable in Lua module code where user: RobinLeicester now has some expertise. He has done well for you and the general case. ChaseKiwi (talk) 12:45, 30 December 2025 (UTC)
- For the images, I believe I am requesting plain commons filenames from wikidata. The module sends a 'File:' instruction with '250px' as the size. If wikidata is adding extra info that would mess this up, but they all look fine on my computer. Is the problem still there on the sandbox version above? I will run some checks.
- For the link problem, I don't see a specific wikibase function to get a link rather than a label. I guess there is a separate P number for it. Any offers on what it is, or a good strategy to extract it, as that will be an easy fix if that is known. (Sorry, despite the above outcome, my wikilink knowledge is pretty marginal). RobinLeicester (talk) 15:22, 30 December 2025 (UTC)
- The 250px is working fine after cache clearing in Firefox and Safari so that is likely the issue for user:Theklan. Mobile not an issue as click thru is disabled. User:Theklan will be used to using the eu:wikipedi and having link served up as say https://eu.wikipedia.org/wiki/Errotz in the title. A json dump tells me this link is hidden under P373 under "sitelinks" "euwiki" "url". I have no idea how you would program to access such as its not assigned a Q or P number and as in this case as no link yet exists on en:Wikipedia it implementation creates issues like also seen with the disambiguation link you get the en:Wikipedia and Ekai (which does not yet have an article for the census area) but has two other meanings. ChaseKiwi (talk) 16:29, 30 December 2025 (UTC)
- We use {{#invoke:Wikibase|getSiteLink|Q3576238}} for that. It gets the link and it's done. However, if the link doesn't exist, there could be something like: #ifexist link, if not... don't add a link. Theklan (talk) 17:13, 30 December 2025 (UTC)
- So here is the current state of play - with the new features still only in Sandbox. Thanks Theklan and ChaseKiwi for very helpful input. I will do some tests on various existing uses, looking out for anything untoward. (I have tried to leave all existing stuff unchanged, but you never know. Anything you can spot will help avoid issues when it goes live).
- It is aimed at three separate scenarios: 1) using the Qvalue within a set of numbered parameters, as in the example above. Allows lots of customisation, but is not very automation friendly. 2) providing the Qvalues as a single comma-separated list. This allows hand-selection of the sites to include, but can all be done with a single parameter, so is easier to pass from, eg, an info-box. (all other features still work, but not very sensible to use on the list items as it is confusing which number they become). 3) Provide a single 'geo-region' Q value, and the program collects any sub-region Qvalues it contains. Not quite as automated as it sounds as it doesn't know what zoom or coord to use, and wikidata values are far from consistent, so releasing a huge number of bot-produced templates will probably result in lots of bad-looking maps. However, such as it is, below I will put a starter towards documenting the new parameters, so if there can be some trying out with the sandbox version any thoughts or suggestions will be extremely helpful RobinLeicester (talk) 14:03, 3 January 2026 (UTC)
- We use {{#invoke:Wikibase|getSiteLink|Q3576238}} for that. It gets the link and it's done. However, if the link doesn't exist, there could be something like: #ifexist link, if not... don't add a link. Theklan (talk) 17:13, 30 December 2025 (UTC)
- The 250px is working fine after cache clearing in Firefox and Safari so that is likely the issue for user:Theklan. Mobile not an issue as click thru is disabled. User:Theklan will be used to using the eu:wikipedi and having link served up as say https://eu.wikipedia.org/wiki/Errotz in the title. A json dump tells me this link is hidden under P373 under "sitelinks" "euwiki" "url". I have no idea how you would program to access such as its not assigned a Q or P number and as in this case as no link yet exists on en:Wikipedia it implementation creates issues like also seen with the disambiguation link you get the en:Wikipedia and Ekai (which does not yet have an article for the census area) but has two other meanings. ChaseKiwi (talk) 16:29, 30 December 2025 (UTC)
- Yes the image problem is a bug likely specific to wikidata downloaded images that I was not able to address using templates as its almost certainly only addressable in Lua module code where user: RobinLeicester now has some expertise. He has done well for you and the general case. ChaseKiwi (talk) 12:45, 30 December 2025 (UTC)
- I see two problems now. First, the link and the label can be different things, so both should be loaded. The other one is that the image in the large maps are shown full width. -Theklan (talk) 08:35, 30 December 2025 (UTC)
| Parameter | Description |
|---|---|
| geo-data-type = | default is P1082 (population). other options include number of households (P1538) per capita income (P10622) land area (P2046) |
| geo-data-list = | this is a comma-separated list of Q values, for a manually generated list that doesn't require nymbered parameters |
| geo-list-sort = | sorts the wikidata/geo-data-list/geo-data numbers for both numbered dots and the caption list. Default is Alpha or A = alphabetic, Value or V = dot value (eg population size), North or N will sort them starting with most northerly, West or W starts with most westerly. (Order can be reversed using VL, NL, or EL (L=Lowest first). A defaults to lowest so AH will reverse, if you really need to). nb: BETA version in Sandbox only, at present |
| geo-scalefactor = | can enlarge or shrink all the dots in proportion, depending on what the map needs (default=1) |
| geo-region = | needs to be a Qvalue of the larger administrative region that the settlements/sub-regions are in. If not present, or if the wikidata page doesn't include the overall total value, the total is the sum of all the shown dot values. |
| geo-sub-region = | needs to be a Pvalue, but will default to P150 if not supplied (some pages use 'has parts' = P527) |
| geo-data3 = etc | numbered Qvalue item, for use in conjunction with other shape/label parameters. Additional option if wanting to to include a manual geo-data item on the fullscreen map, but not on the list, is to use mark-title3=nolist. (As before, mark-title3=none will show any map items, but exclude from both the list and fullscreen) |
| shapeD = | (same as before). It sets default shape, which might be n-circle to include numbers/auto-caption list. other 'D values can also be used to set color, outline etc |
| geo-number-size = | will give a fixed size for shape numbers, if they are shown. (defaults to 12 when using proportional dots) |
| geo-boundaries = | if set to 1 will add the sub-region Qvalues to 'map-data-light', to show the boundaries on the map. |
| show-geo-dots = | defaults to '1' if there is a geo-region, to use proportional dots. If its is '0', there will be a fixed dot size of 1px, eg to show labels and boundaries without dots) |
| find-geo-dots = | 1 or 0 (needs to also include geo-region, when it will default to 1. '0' allows for just finding boundaries, and/or just using manually supplied Q values, for example. |
| label-posD = | gets additional options: [off] gives no label, [on] will position lower centre. To include numeric values use [on+] or [on^] or [on-], also works with left/right/top/bottom etc positions. '+' will put the numbers on a new line if the pos is top+, bottom+ or on+, or alongside the label if left+ or right+. Alternatively use 'on^' etc to always have a new line, or 'on-' etc to always have them alongside. |
RobinLeicester (talk) 14:15, 3 January 2026 (UTC)
Total South Wales area (sum of datapoints) = 3,631sq.km
| No. | South Wales | area sq.km | year |
|---|---|---|---|
1 | Monmouthshire | 849.09 | 2016 WD |
2 | Neath Port Talbot | 441.31 | 2016 WD |
3 | Rhondda Cynon Taf | 424.15 | 2016 WD |
4 | City and County of Swansea | 379.66 | 2016 WD |
5 | Vale of Glamorgan | 331.08 | 2016 WD |
6 | Caerphilly County Borough | 277.39 | 2016 WD |
7 | Bridgend County Borough | 250.73 | 2016 WD |
8 | City and County Borough of Newport | 190.52 | 2016 WD |
9 | City and County of Cardiff | 140.9 | 2016 WD |
10 | Torfaen | 125.7 | 2016 WD |
11 | Merthyr Tydfil County Borough | 111.45 | 2016 WD |
12 | Blaenau Gwent | 108.73 | 2016 WD |
- Thanks for the good work. Will do some test cases in my own sandboxes. ChaseKiwi (talk) 14:42, 3 January 2026 (UTC)
- Works a treat with only one apparent minor bug and I can see implementation will identify unexpected gaps in data in wikidata. For England it transpired no land area for Greater London which I suspect I will rectify non urgently. It also transpired that the sum of datapoints was 10,000 when no values existed for per capita income for England admin subdivisions as far as I could see so summing function seems to have bug. California's 58 counties required rather large map to show the detail, as did NZ but thats no real issue. ChaseKiwi (talk) 10:09, 4 January 2026 (UTC)
- I have taken the plunge and gone live with the sandbox lua module. Hopefully everything remains working as it should, but please alert if anything is untoward. I recall ChaseKiwi mentioning use of hidden categories to track use of different features. Both for this and the GeoJson features, that would definitely be interesting to have, but I am very unclear how to make it happen. (Also not sure if that would impact its use on other wikis). If you or Theklan have any info on this, that would be great.
- New revision of geo-data feature is now live. Key updates are to the auto-caption, which is a table instead of a list, Sort options, removing wikidata links from the map-dots. All the caption data should use the language of whatever wiki is using the template, provided it is available at wikidata. RobinLeicester (talk) 18:44, 19 January 2026 (UTC)
Displaying map next to a bulleted list
[edit]I was trying to replace the image with an OSM map in the 'Teams' section of the Mandak League article. The map would look like the one on the right. The issues is that, when I try putting it into that section of the article, it displays either above or below the bulleted list of teams in that section, instead of next to that text. I haven't been able to figure out a parameter in the OSM map template to fix that problem. The image that's in that section of the article right now displays next to the text just fine so I'm not sure what's wrong here. Any guidance would be appreciated. Dennis C. Abrams (talk) 16:53, 5 February 2026 (UTC)
- Have you used the
{{clear}}parameter before the {{OSM Location map}} call ? Usually thefloat =right left and center options work fine and allow direct substitution of an image of same width. There are exceptions with the center option and some implemented non-default parameters as in documentation. You may have to adjustwidth =- for example the map you have is wider than the maximum of 300px that displays well on a mobile device. ChaseKiwi (talk) 17:16, 5 February 2026 (UTC)- I didn't think to put {{clear}} before. That worked perfectly. Thanks so much. Dennis C. Abrams (talk) 18:15, 5 February 2026 (UTC)
Proposal: New "line" shape
[edit]Currently, Template:OSM Location map supports shape=rule for straight lines, and shape=curveA / shape=curveC for small arcs. However, these are limited:
- rule requires a midpoint, fixed length, and angle; it cannot easily connect two specific points.
- curveA and curveC produce curved arcs, but the start and end coordinates are approximate, require manual curvature or control point calculations, and may not pass exactly through desired markers.
To solve these issues, this proposal introduces shape=line to connect **two specific coordinates** precisely.
---
Syntax
[edit]| labelX = <label for the line>
| shapeX = line
| start-coordX = {{coord|LAT1|LON1}}
| end-coordX = {{coord|LAT2|LON2}}
| shape-colorX = <line color>
| shape-outlineX = color,line-thickness,opacity,css-style
| gapX = <distance in meters between dashes, optional>
| label-posX = <label position relative to line, optional>
| label-offset-X = <vertical offset, optional>
| arrowX = 1 <!-- optional: arrowhead at end -->
---
Parameters
[edit]| Parameter | Type | Description |
|---|---|---|
| shapeX | string | Must be "line" to activate this mode |
| start-coordX | coord | Latitude and longitude of line start |
| end-coordX | coord | Latitude and longitude of line end |
| shape-colorX | color | Color of the line |
| shape-outlineX | color,line-thickness,opacity,css-style | Full outline definition: • color = outline color • line-thickness = in px (0 = no outline) • opacity = 0–100% • css-style = solid, dashed, dotted, double |
| gapX | number | Optional: gap between dashes in meters; useful for long lines |
| arrowX | boolean | Optional: arrowhead at the end of the line |
| label-posX | string | Optional label position relative to the line |
| label-offset-X | number | Optional vertical label offset |
---
Examples
[edit]Simple line (solid)
[edit]| label1 = York–Selby
| shape1 = line
| start-coord1 = {{coord|53.96|-1.08}}
| end-coord1 = {{coord|53.78|-1.08}}
| shape-color1 = blue
| shape-outline1 = black,2,100,solid
Draws a solid blue line connecting York → Selby with a black outline of 2px thickness and 100% opacity.
Dashed line with arrow
[edit]| label2 = Selby–Leeds
| shape2 = line
| start-coord2 = {{coord|53.78|-1.08}}
| end-coord2 = {{coord|53.81|-1.57}}
| shape-color2 = green
| shape-outline2 = black,1,50,dashed
| gap2 = 200
| arrow2 = 1
Dashed green line connecting Selby → Leeds, with 50% opacity and a black dashed outline. Arrowhead points to Leeds.
---
Why not use curveA / curveC
[edit]1. **Precision**: Curves approximate start and end points and require manual radius or control points, so they rarely pass exactly through the markers.
2. **Angle complexity**: You must manually calculate curvature and angle to match endpoints.
3. **Distance scaling**: For long connections (e.g., York → Leeds), curves may overshoot or undershoot the towns.
4. **Purpose**: Curves are visually appealing for stylized paths, but `line` is more functional for **historical battle maps or transport routes** where exact endpoints are required.
5. **Outline control**: Full `shape-outline` (color, line-thickness, opacity, css-style) is fully supported for `line` and can be applied consistently along straight connections. Curves often distort dash spacing or opacity when projected on the map.
---
Benefits of shape=line
[edit]- Connects two coordinates **exactly** without calculating midpoint, length, or angle.
- Works for **short or long lines**, including distances beyond the rule maximum.
- Supports **dashed, solid, or arrowed lines** using full `shape-outline`.
- Compatible with labels, offsets, and other existing map parameters.
- Keeps maps visually clean and functional for historical, transport, or route diagrams.
---
Backwards compatibility
[edit]- shape=rule and shape=curveA/curveC remain unchanged.
- shape=line is additive and optional.
- Lines are drawn below markers to avoid obscuring them.
Bjmvianen (talk) 16:19, 16 February 2026 (UTC)
- Hi Bjmvianen, thanks for the input on drawing lines. There is good news of a sort in relation to your question as at least some of what you are looking for is already possible. In a wierd and mildly clunky way, you can draw a line from a coord-point to the 'one-before' coord (eg, from mark-coord2 to mark-coord1).
- This example does the York to Selby example you describe, using the line
| label-pos2=left,mark-line,2,solid,0to draw the line. It also can have width, style, gap and optionally nominate a different marker destination number. - There is also some less good news: an Arrow will need to know the angle to point to, and should get the tip of the arrow at the right spot - I think that could be harder than might first appear. I will need to revisit the code to see if that can be done. Similarly, getting the label to be rotated to the correct angle to run along the line involves setting up bits of the code that have very different expectations. If there is a single clear use case, these things can be done, but they then get much harder to make generally useful, so that would be best done by hand, I think, as in the example.
- The 'gap' in the code is to enable two parallel dotted or dashed lines, and sets the gap between them. CSS only has default dotted and dashed options. Setting the gaps between dashes would be vastly harder. There is some work supposedly progressing to allow inline svg in wikipedia, which may make such things possible, but they will still be pixel based, rather than setting actual measurements along the map.
- And finally - I realise that
ruleAhas never been documented. It has all the issues you correctly identify regarding 'rule', but it will draw an arrow on the end of any of the line styles that rule can draw. I will add this to the documentation page, with apologies for that omission. RobinLeicester (talk) 22:50, 16 February 2026 (UTC)
- Update - A useful re-visit to the code has tidied up a few issues that have improved 'mark-line'. In particular I had not documented that any other mark could be nominated by adding a final item. Also, I have now applied the useful suggestion of the label taking the angle of the line by default. (unless overuled by, for example, label-angle2=0) As I feared, arrows feel much trickier, so no progress there. Documentation and an example have been expanded accordingly. RobinLeicester (talk) 23:43, 17 February 2026 (UTC)
- Update2 - with a bit of lateral thinking, arrows are now implemented as an 'arrowhead' shape, which also acquires its angle from the line, like the text. In the Battlefield example, the 4 arrows each have their own coord-location at the 'arrow' end, with the other end of the line being the two camps, so each camp is 'used' by two arrows. (Note, lowest numbered marks are drawn last, so use these for the items that go 'on top').
Question
[edit]If this is not the correct forum, then I apologize in advance and please point me to one, if it exists. Template:NFL labeled map includes the color key in the upper middle portion of the map. I would like to move it to the caption, next to "Location of NFL teams", but am not sure how to do so. Any suggestions? Assadzadeh (talk) 20:26, 3 March 2026 (UTC)
- Hi Assadzadeh, You are in luck. There is now a 'legendbox' feature that allows you to list dots in this way, within a box that can then be put where you want. I have commented out your whole divisions section, as the legendbox picks up the attributes from actual dots on the map. It can only do a single column, as shown. The box uses pixel x,y rather than lat,long coordinates, so the 10px54px puts it 10 pixels from left and 54 from the top of the box, so changing these enables you to move it to where you want. Also, triple-quotes don't work here for bold. You could use <b>NFC South</b> if you wish to. RobinLeicester (talk) 18:01, 4 March 2026 (UTC)
- Thanks for the feedback. Actually, now that I see the legendbox, I would prefer it on the map, than in the caption. Also, where can I find the choices for background, text color, and options? Assadzadeh (talk) 19:09, 4 March 2026 (UTC)
- The section at Template:OSM_Location_map#Full_table_of_color_options shows the 'named colors' within this template, or you can use any #rgb code for any Web colors. Note however that if, as you have here, text is a wiki link, it will always be the color of unvisited/visited links, eg blue/purple. RobinLeicester (talk) 21:50, 5 March 2026 (UTC)
- Just realised you actually wanted to move it into the caption. It can be done using {{legend}} entries within the caption, which would come out looking like , and should be possible to format in columns, etc. RobinLeicester (talk)
- Thank you for pointing out this feature! It'll certainly make things easier for more complex bits of wiki-cartography I'll be tackling in the future. I have a question, though: the documentation states that the legend title is "
optional
", but I'm unsure how to remove the title, as – to use the example above – removingThe Divisions,from|legendBox=The Divisions,87px124px1px, 10px54pxcompletely breaks the legend box. — AFC Vixen 🦊 06:08, 9 March 2026 (UTC)- I've recieved an answer to this question at Wikipedia:Village pump (technical)! — AFC Vixen 🦊 08:27, 10 March 2026 (UTC)
- Thank you for pointing out this feature! It'll certainly make things easier for more complex bits of wiki-cartography I'll be tackling in the future. I have a question, though: the documentation states that the legend title is "







