Module talk:Location map

From Wikipedia, the free encyclopedia
  (Redirected from Template talk:Location map)
Jump to: navigation, search

Add overflow=hidden property by default[edit]

Please see Template:Location_map+/testcases#Overflowing_labels_.7C_overflow.3Ddefault. I've made a small addition to Template:Location map+/sandbox that sets by default the overflow:hidden CSS property on the map container. This should fix the minor but annoying layout bug on articles such as Caterham and Oxted (links to versions that show the bug), where an overflowing map label causes a horizontal scrollbar to appear in the browser (I've wondered since March what was messing the page layout on Caterham, and now finally found it.) To fulfill the request, simply copy&paste the content of Template:Location map+/sandbox to Template:Location map+. Thanks, --hydrox (talk) 01:24, 2 December 2013 (UTC)

Done. Thanks for the fix! — Mr. Stradivarius ♪ talk ♪ 02:22, 2 December 2013 (UTC)
Please revert and discuss, it is better to have overflowing text than hidden text. If the problem is solely due to the map pushpin label overflowing the right-hand edge of the map, the solution is simple - reposition the label. In the case of pages using {{infobox UK place}}, such as Oxted, you would do this. --Redrose64 (talk) 10:52, 2 December 2013 (UTC)
It's anyway a bad idea to have relatively positioned block elements floating around the page, as those can cause strange rendering issues. Setting overflow:hidden on the container gets rid of those. I would first like to see a concrete example where this causes any issues, other than making editors aware that there are labels in the location map that should be maybe aligned differently. --hydrox (talk) 22:06, 2 December 2013 (UTC)
Wikipedia Rollbacker.svg Reverted, please continue the discussion. — Martin (MSGJ · talk) 12:53, 3 December 2013 (UTC)
So this was essentially rejected – instead of actually engaging in a discussion and addressing my points User:Redrose64 has disappeared after the complaint? --hydrox (talk) 17:35, 5 December 2013 (UTC)
No, I've not disappeared. I've already indicated that the problem may be overcome using existing methods - the |label_position= parameter; you yourself have used them. I'm waiting for other people to demonstrate that overflow:hidden; is a good idea, per WP:BRD and WP:CON. --Redrose64 (talk) 17:40, 5 December 2013 (UTC)
Well, there can not be consensus for introducing something entirely novel (there are zero hits in this page's archives for "overflow"). And people will not know to come discuss here if there's nothing broken. But I am okay with holding this change at least until I am next time annoyed by randomly appearing scroll bars in the page. --hydrox (talk) 18:01, 5 December 2013 (UTC)
It looks to me like the real problem isn't this template, but {{Infobox UK place}}. That template specifies a default |label_position=right if one isn't explicitly specified, when really it shouldn't specify a default at all and allow this template to supply its own default. I believe this template automatically puts labels on the east side of the map on the left instead of the right, if not overridden. -- Dr Greg  talk  19:21, 5 December 2013 (UTC)
Note to all page-watchers. This template has been converted to Lua, and so its code can no longer be understood. I shall therefore cease offering assistance in the use of this template, and will unwatch this page: consequently, my comment "I've not disappeared" of 17:40, 5 December 2013 no longer holds true. --Redrose64 (talk) 21:17, 13 March 2014 (UTC)
How does Lua mean its code can no longer be understood? Lua let the code be simplified from its original form. Jackmcbarn (talk) 21:22, 13 March 2014 (UTC)
As the original author of the horrible wiki code, I must say that this lua rewrite hasn't improved it. 400 lines of code for a simple pushpin map seems quite bloated, and the produced HTML is now impossible to edit for a non-programmer. I haven't done any lua programming on mediawiki yet, so I'm not sure how feasible this is, buu IMHO, it would make much more sense if only the projection calculations were farmed out to lua, and the html was still produced by a (hopefully more readable) wiki template. Zocky | picture popups 01:57, 2 May 2014 (UTC)
The reason that isn't feasible is performance. Parsing wikitext is a lot slower than running Lua, and it sends the post-expand include size through the roof. There's several pages right now that would fail to parse if any of the work were done in wikitext, because they would exceed the allowable limits for parsing. Jackmcbarn (talk) 02:18, 2 May 2014 (UTC)
the backlash is not surprising considering it was never discussed before being deployed. Frietjes (talk) 14:50, 2 May 2014 (UTC)

New USA Southeast Location Map[edit]

Can anyone help with creating a location map for the Southeast of the United States. I've been trying to find a map of the Southeast US and have been unable to. The map would include: Washington DC, Virginia, West Virginia, Kentucky, Arkansas, Tennessee, North Carolina, South Carolina, Georgia, Florida, Alabama, Mississippi and Louisiana. It can include parts of other states obviously but the idea would be for it to be about the bottom quarter of the normal USA Location Map. I've tried creating one but have failed. Thanks. Mak888 (talk) 02:57, 12 January 2014 (UTC)

do you have an image uploaded? if you upload a cropped version of the main one, I can help with the parameters. Frietjes (talk) 16:35, 13 January 2014 (UTC)
I wasn't sure if that would make it more difficult since you wouldn't have the original dimensions. If you took literally split the USA location map in 4 parts and took the bottom right hand corner that should work or be close, may needs to be a little farther north. I only have paint on my computer so can't do much. Mak888 (talk) 22:18, 14 January 2014 (UTC)
I'm in the same situation, but will have access to something better this weekend. just to double check, do you want all the states in dark red shown in Southeastern United States, or the ones in lighter red as well? Frietjes (talk) 22:22, 14 January 2014 (UTC)
hey sorry forgot about this, could use all the ones color, both light and dark red. thanks Mak888 (talk) 05:01, 7 February 2014 (UTC)
if you can have someone help you make cropped versions of the two maps in Template:Location map USA and upload them, I can relatively easily make the new location map. whoever crops the images should keep track of exactly how many pixels were cropped off each side of the image. I can do it, but I will need to install inkscape to do it properly. you might be able to find someone to help you faster at Wikipedia talk:Graphics Lab/Map workshop. Frietjes (talk) 14:24, 7 February 2014 (UTC)

Transcluding missing modules[edit]

can we fix Special:WhatLinksHere/Module:Location map/data/Africa and similar (currently redlinked modules) in the new module version? if not, we should revert to the old version. Frietjes (talk) 13:27, 14 March 2014 (UTC)

also, if the plan is to simply create these missing modules, we need to have a plan for how we preserve attribution when the are copied. Frietjes (talk) 13:34, 14 March 2014 (UTC)
The way the code works is it tries to transclude Module:Location map/data/whatever, and if it fails, it uses Template:Location map whatever instead. This seems fine to me, and I'm not sure why it would need to be changed. Is there a concern with transcluding nonexistent modules? Jackmcbarn (talk) 15:45, 14 March 2014 (UTC)
a few questions: (1) where was the switch to lua and new code design discussed? (2) if there is no answer for question 1, then where is the performance comparison between the old and new version? (3) if there is no answer for question 1, what are the benefits for switching to lua? (4) does the new module strip spurious whitespace in multiple-pin invocations, (5) what happens if an editor sees a redlinked module, clicks on it, and creates something non-functional? or have all the location maps been converted and given the same protection level as the templates? (5) why were some templates moved to an attribution page without redirect, and others with redirect? Frietjes (talk) 15:57, 15 March 2014 (UTC)
1. It wasn't. 2. The new code is about 3 times as fast (Template:Syrian civil war detailed map went from about 30 seconds render time to about 10). 3. Mainly performance, also cleaner code. 4. I'm not sure what you're asking. Can you give me an example? 5. That is a concern. Right now, that could cause damage. I'll work on a solution to that. 6. None of them should have redirects. I tagged most of them for deletion, but I may still have some more to do. Jackmcbarn (talk) 16:22, 15 March 2014 (UTC)
I am definitely concerned that this was not discussed prior to rolling it out. There should be at least the appearance discussion before changing such widely used templates. Transcluding missing templates is also a concern, we should do something about this. Plastikspork ―Œ(talk) 21:12, 15 March 2014 (UTC)
With regard to item 4, see this thread above. We should not orphan the redirects in the near term, unless they have zero transclusions. Just my 2 pence. Plastikspork ―Œ(talk) 21:15, 15 March 2014 (UTC)
They have 0 transclusions. The job queue just hasn't caught up yet. Re 4, blank lines do break it, but since they broke it before, I'm not overly concerned right now (though I can fix that easily now). Regarding transcluding missing things, if needed, I can change the code to do an equivalent of a #ifexist before trying to load, but what's the benefit of that? Is there a database report containing redlinked templates that this is filling up? Jackmcbarn (talk) 21:19, 15 March 2014 (UTC)
Note, 0 transclusions in article space is not the same as 0 transclusions. Yes, there is a database report for redlinked templates that this is filling up. The benefit of an ifexist check would be to not transclude missing modules. I thought that much was clear in the thread above :) Plastikspork ―Œ(talk) 21:37, 15 March 2014 (UTC)
Okay, it doesn't transclude missing modules anymore. Jackmcbarn (talk) 23:10, 15 March 2014 (UTC)

"Script error"[edit]

The article List of National Trust properties in Somerset uses Location map+ and has previously worked fine. It is now showing script error and I can't work out why. If anyone had any ideas (or fixes) that would be great.— Rod talk 18:26, 15 March 2014 (UTC)

You had a typo in the template call. I fixed it. Jackmcbarn (talk) 19:25, 15 March 2014 (UTC)
Thanks - I think this must have been introduced when someone used AWB to fix some citations etc which may have removed the "|" between Somerset & label. I had stared at it for ages & not spotted that.— Rod talk 19:30, 15 March 2014 (UTC)

Another script error is showing up on Yorkshire and the Humber (European Parliament constituency). If someone could take a look. Thanks. Keith D (talk) 20:20, 20 March 2014 (UTC)

fixed. Frietjes (talk) 20:36, 20 March 2014 (UTC)
Thanks for quick response. Keith D (talk) 20:58, 20 March 2014 (UTC)

Help with Sevastopol's location map[edit]

I can't get the coordinates right for {{Location map Sevastopol}}

When I place the pins they are either too far east or too far north.

Can someone help please?

Ahnoneemoos (talk) 17:19, 29 March 2014 (UTC)

  • @Ahnoneemoos: New location maps should be created as modules rather than templates (see Template:Location map/Creating a new map definition for details). Anyway, are you sure the image you're using is an equirectangular projection? Jackmcbarn (talk) 01:29, 30 March 2014 (UTC)
  • The image's author doesn't know whether or not it's equirectangular. Since it's been giving you so many problems, chances are that it's not. Only equirectangular projections work with location map unless you know the exact equations for the projection used, unfortunately. Jackmcbarn (talk) 01:37, 30 March 2014 (UTC)
  • Anyone can make them. Just make sure you specify it has to be equirectangular when you ask for it. (And can you {{db-g7}} the template and restart it as a module?) Jackmcbarn (talk) 01:55, 30 March 2014 (UTC)

Location_map templates deleted[edit]

Several admins circa 15 March 2014 have deleted some of the nation/region templates of Template:Location_map (changed to use Lua modules), which might be needed to format prior revisions of pages with maps. Specifically:

Various admins have deleted/moved those templates and /doc subpages. In particular, Template:Location_map_Italy/doc needs to be unmoved or undeleted. There might be other mapper templates which were also deleted. The migration of {Location_map} to Lua has caused problems of "Script error, and is not portable to all browsers. Remember, Lua errors do not kill an entire article, but kill the whole template, whereas markup-based templates could display partial results (such as a map with error message for the user, but Lua shows "Script error" and no clue why). Currently, Template:Location_map_all is/was the faster, portable template to quickly display maps in rectangular coordinates on any browser, but it uses the map helper templates. -Wikid77 (talk) 15:19, 6 April 2014 (UTC)

Why do those need to be undeleted exactly? What articles specifically have script errors because of the Lua migration? Template:Location_map_all was moved to sandbox as a result of TfD. Those old templates are unused and should stay that way. Any benefits of any of your several forks of this template can and should easily be applied to the module, though I still have yet to see one that's not already applied. Jackmcbarn (talk) 15:54, 6 April 2014 (UTC)
To the reason given in the first sentence there is no need to 'format prior revisions'. I understand what you mean - as templates, categories, images are moved, renamed and deleted there's no way to fix old revisions of articles that still include the old versions. But that is not a problem we should be trying to solve as it's essentially unsolvable. The revisions primarily exist for attribution, as when you look at the diffs of an editors contributions or a page history you need both versions of the article to diff. They are also occasionally useful for content, such as content that was deleted for lack of notability but sources can now be found. But these previous revisions aren't meant to be read as articles, and expending effort fixing problems with them is essentially wasted effort as most problems can't be fixed so they'll never be of article standard.--JohnBlackburnewordsdeeds 16:09, 6 April 2014 (UTC)
Further, the claim that previous revisions break at all is completely wrong. Old revisions of pages use the latest revision of Template:Location map, not the version that existed when they were saved, so the module data works fine with them. Jackmcbarn (talk) 16:13, 6 April 2014 (UTC)
The prior page revisions which use Template:Location_map_all will break when the helper templates have been deleted. You obviously do not understand the situation, and you need to stop deleting templates which have been developed over the past 8 years. Perhaps 8 years from now, you will have a better understanding. -Wikid77 (talk) 16:35, 6 April 2014 (UTC)
Then we can recreate Template:Location_map_all as a redirect to Template:Location_map_many for the very few pages that ever used that. And besides, as JohnBlackburne said, it's not a big deal if they break. Jackmcbarn (talk) 16:45, 6 April 2014 (UTC)
And don't say I'm deleting templates. Your templates were deleted because consensus at TfD was to delete them. The community deleted them. Jackmcbarn (talk) 16:46, 6 April 2014 (UTC)
I understand it perfectly well, as I made clear in my first reply. As I explained 'fixing' old revisions is not possible and not something editors should waste time on. Articles, images, categories, are deleted or moved without redirect every day. We fix problems this causes in live articles, but can't fix old articles. This is in some ways a feature: the red links help remind readers, if they stumble on an old revision as they're sometimes linked, that the page is out of date. They can also follow the redlink to read the log entry to see why, use 'What links here' to find any discussion or notice, often (in the case of the template) the current alternative they should be using.--JohnBlackburnewordsdeeds 16:48, 6 April 2014 (UTC)

@Jackmcbarn, Wikid77, and JohnBlackburne: Jackmcbarn has asked me to look into this dispute as a neutral third party. I can see several points under discussion here, but in situations like this I've found that it's easiest to deal with one thing at a time. So let's start with the thing that I thought stood out the most - the question of whether the Lua migration of {{Location map}} generated script errors. Obviously, we want to avoid script errors. But equally, we shouldn't avoid using Lua because of the mere possibility that script errors might occur. There are various ways of avoiding script errors, and to me it seems premature to stop using Module:Location map without considering any of them. Wikid, is it just the possibility of generating script errors that you are worried about, or did you actually see script errors generated on any pages? Were those script errors in the current revisions of those pages, or were they in previous revisions? Once we are sure of the facts here, I think it will be a lot easier to deal with the rest of the points that have been raised. Best — Mr. Stradivarius ♪ talk ♪ 10:52, 7 April 2014 (UTC)

With several related issues, I agree it would be better to discuss each issue as separate threads below:
          • "#Avoiding script errors"
          • "#Support for any browser"
Reply at each thread. -Wikid77 17:10, 7 April 2014 (UTC)

Avoiding script errors[edit]

I see Jackmcbarn has been writing Module:Location_map, and I had not viewed the source code earlier. I think we need to check calculations and invalid numbers in the lat_deg & lon_deg parameters, without showing script error (which has been fatal to omit the entire map, with no warning messages to the user). A possibility would be to attempt to auto-correct invalid digits, or assume an invalid latitude (or longitude) is the mid-point between the map's extreme values. To just show "Script error" would be much worse than a map with an invalid-expression message, and it would be good to alert the user with the caption, "[fix latitude]" or such in the map's caption. Compare results of templates below.

Example of Imotski in Croatia
{{Location map | Croatia
| lat = 43.44 | long = 17.21 | label = Imotski
  | position = right
  | background = #FFFFDD
| width =180 | float = left | marksize=4
| caption = Imotski {Location map}
| alt = Imotski is in Croatia.
Result from {Location map}   
Imotski is in Croatia.
Imotski is in Croatia.
Imotski {Location map}
Result from {Location map quick}
Imotski (Croatia)
in {Location map quick}

Test invalid data "long = 17.x".
Result from {Location map}   

Lua error in Module:Location_map at line 337: The value "17.x" provided for longitude is not valid.

Result from {Location map quick}
Imotski (Croatia)
<div style="position:absolute; z-index:2; top: 70.9%; left: Expression error: Unrecognized word "x".%; height: 0; width: 0; margin: 0; padding: 0;">
in {Location map quick}

The original operation, from years ago, was to warn the user when invalid coordinates were entered, but those messages were omitted in various mapper templates. -Wikid77 17:10, 7 April 2014 (UTC)

Yes, one shows Script Error, the other an error. But click on Script Error and you see the error in a popup, with a precise error and stack trace, much more useful for tracking down the problem. Mostly though for ordinary editors either works to let them know there's a problem and to check the parameters. Editors aren't expected to know Lua debugging or parser error parsing (and parser functions often don't produce an explicit error, they just show the wrong thing). For most the best thing is point out there's an error to get them to check the parameters. For technical editors and those actually testing the stack trace is far the more useful of the two.--JohnBlackburnewordsdeeds 17:24, 7 April 2014 (UTC)
Thanks for the reply. It is certainly possible to generate a more meaningful error message in this situation. For example, we could check whether the longitude variable exists before we do any arithmetic on it, and if it doesn't exist we could raise an error like 'longitude value "17.x" is not a valid number'. If we want, we could also make this a wikitext error rather than a script error, although that may require some re-engineering of the module. Wikid, would you be satisfied with a script error that contains a more informative error message after you click it, or would you prefer that the error message be a wikitext error? — Mr. Stradivarius ♪ talk ♪ 18:36, 7 April 2014 (UTC)
I think any use of "Script error" (even if linked to Lua diagnostics) would be trouble for the end-users, so I suggest to use autofixing of invalid parameters, to display a map with partial marker data; see below: "#Autofixing map parameters". -Wikid77 05:21, 8 April 2014 (UTC)

Autofixing map parameters[edit]

A map marker can be autofixed to overcome some cases of invalid latitude, longitude or other parameters, as "robust" operation. Showing an invalid map as "Script error" is likely to confuse the end-users, especially if the invalid map data was an accidental "drive-by" glitch by another user who intended to change some other part of the page, but mistakenly botched the map parameters. The goal is to show the map with an autofixed marker, if possible, where even a newcomer might be able to write a nearly correct map, while not understanding the exact parameters to align markers "perfectly" with labels.

The example below shows a proposed {{Location_map/new2}}, where the invalid longitude "17.x" is auto-trimmed to "17." to show the map marker, slightly off-course, and avoid "Script error" caused by "tonumber(degree)" returning "nil" for invalid numbers.

Example of Imotski in Croatia
{{Location map | Croatia
| lat = 43.44 | long = 17.x | label = Imotski
  | position = right
  | background = #FFFFDD
| width =180 | float = left | marksize=4
| caption = Imotski {Location map}

Test invalid data "long = 17.x".
Result from {Location map}   

Lua error in Module:Location_map at line 337: The value "17.x" provided for longitude is not valid.

Autofixed in {Location map/new2}
Imotski is located in Croatia
in {Location map/new2} [fix long=17.x]

In the above example, the invalid data "17.x" is auto-corrected as just "17." with the superscript note "[fix long=17.x]" to remind the user of the problem. In general, I think invalid numbers could be autofixed digit-by-digit (by Lua gsub()?), such as replace letter "o" as digit zero "0" or letter "i" as digit one "1" or perhaps letter "x" as "5" then check the result against the map's edges for the valid range of longitudes, and when an autofixed number is outside the range, then use range/2 to autofix an invalid coordinate as half-way (center) of the specific map, plus show "[fix__]" in the map's caption. A previous common glitch in many maps for the past 8 years has been invalid "px" in "width=180" but {Location map} already autofixes "180px" as being valid "180" while "width=180x" would show fatal Script error, and could be autofixed as "180" or default "200" when the "width=#$%" cannot be deciphered. Because Lua is so fast, then autofixing can be run in a tiny fraction of a second while adjusting several parameters. -Wikid77 05:21, 8 April 2014 (UTC)

I think that type of autofixing would be a little bit too aggressive. I'd rather strip out everything except numbers, "-", and ".", then parse whatever's left as a number. Jackmcbarn (talk) 12:39, 8 April 2014 (UTC)
The live errors also crashed on "long=−0.5" with the true minus-sign character for &minus ('−') causing Script error with tonumber(). -Wikid77 14:32, 8 April 2014 (UTC)
This looks like something Module:Math could be updated to handle. Jackmcbarn (talk) 23:09, 8 April 2014 (UTC)
Wikid, one thing I would add to this is a tracking category - this would enable users who know the template syntax to patrol pages containing errors. — Mr. Stradivarius ♪ talk ♪ 13:36, 8 April 2014 (UTC)
Agreed that a tracking category could be used to help spot the rare typos, as with the wp:CS1 cite templates where users leave invalid cite parameters in 20-50 more pages everyday, despite the cite's glaring red-error messages which should cause people to immediately fix cite errors, but instead had been left in 9 thousand pages (1-in-240 pages) all year (2013, viewed up to 5 million pageviews), until fixed by cite gnomes. -Wikid77 14:32, 8 April 2014 (UTC)

As with citations autofixing seems a bad idea: make the errors obvious and glaring, so they get fixed as soon as possible. Just point out there's an error - it seems pointless writing code to handle all possible errors as no matter how clever and complex the code editors will always come up with more ways to break things. Error messages could be more friendly but mostly there should be errors encouraging editors to check their code.

Besides this is very different from citation templates. Errors in those appeared primarily due to the Lua transition flagging so much more of them. There's been no comparable transition in this template. Citation errors are often rather subtle - deprecated parameters, mispellings - so the template still works. A map either works or it doesn't. And maps are part of the content, not necessary but largely ignored footnotes shunted to the bottom of the page. I would think editors very rarely add a broken map to an article - they'll want to see if it works and when it doesn't work fix it immediately.

Real-life examples of script errors[edit]

So we have now established that under some circumstances, the module may produce a script error whereas previously the template would have produced an inline error. However, it is not yet clear exactly how serious the problem is. One part of my original question was about real-life examples of script errors. I was concerned about this due to Wikid mentioning here that "The migration of {Location_map} to Lua has caused problems of Script error". Wikid, could you clarify where you saw these script errors? Were there any script errors present in any articles after the migration? — Mr. Stradivarius ♪ talk ♪ 06:21, 8 April 2014 (UTC)

I hit a "Script error" when replying to a separate TfD issue. -Wikid77 (talk) 07:03, 8 April 2014 (UTC)
Was the error at TfD the same issue? The error where longitude is a nil value? — Mr. Stradivarius ♪ talk ♪ 07:12, 8 April 2014 (UTC)
Both latitude & longitude, with expressions, such as "lat=(23+5/60)" which worked in the markup-based {Location_map}. -Wikid77 (talk) 09:04, 8 April 2014 (UTC)
Expressions as input could be worked around using Module:Math#cleanNumber. I'm not sure how common that case would be, though. The cleanNumber function does rely on calling the #expr parser function via a frame object, though, which is not ideal. Better would be to update Scribunto so that we can access the #expr PHP code directly, or perhaps to write a pure Lua version. I did have a look to see if anyone has already written an open-source program that we can use, but I couldn't find anything. It looks like no-one has gone to the effort of writing such a function, as with standard Lua this issue can be worked around easily using the loadstring function; however, loadstring is disabled in Scribunto for security reasons. — Mr. Stradivarius ♪ talk ♪ 10:36, 8 April 2014 (UTC)
Has "lat=(23+5/60)" ever been used in the wild? We support decimal syntax and dms syntax. Is support for this method really necessary? @Mr. Stradivarius: I'll work on exposing #expr functionality directly to Lua. Jackmcbarn (talk) 12:39, 8 April 2014 (UTC)
I don't think it is really necessary - I can't see users expecting to be able to input expressions, and an informative error message should be enough to guide them into correcting what went wrong. From Wikid's answer above it looks like only one article is confirmed to have had a script error appear, and even if there are more that we aren't aware about the number is probably not more than five or ten. This makes me think that overall, the script error problem is not that important.

However, I tend to agree with Wikid about user-facing script error messages not being ideal - even if the actual error message tells the user exactly what they need to fix, many editors aren't aware that they can click on the script error text to find that information out. What do you think of Wikid's error checks, by the way? At first I thought that was just a mock-up that he posted here, but I see that he's actually implemented the code in Module:Location map/sandbox2. Sorry, I see that you've commented on this above, and it's a bit off-topic in this section.

Also, thanks for agreeing to expose #expr from Lua - that will be really helpful. Don't overexert yourself though! Beware of coder burnout. :) — Mr. Stradivarius ♪ talk ♪ 13:27, 8 April 2014 (UTC)

Regarding user-facing errors, Lua modules themselves have an "Allow saving code with errors" box, unchecked by default. Would something like that be useful outside of module space (not concerned about implementation, just about whether it would be a net benefit or not)? Jackmcbarn (talk) 23:33, 8 April 2014 (UTC)

──────────────────────────────────────────────────────────────────────────────────────────────────── An interesting idea. I like it for modules - a non-compiling module is no use to anyone – but I suspect it might cause many more problems with articles and so be strongly resisted. Article errors are far more diverse - Lua errors, parser errors, wikimarkup and HTML errors. And editors can easily introduce them as they work on an article. References in particular are often assembled at different times to the article, because the editor does not have access to all the sources, or does not have complete information. Sometimes errors arise when section editing, when you can't see the rest of the article. Again this is often a problem with references - removing a named one, unaware it's used in another section, for example.

It would significantly slow down editing too. If it checks for errors before saving then it has to parse and render the page, before doing it again after the page is saved, so rendering the whole page twice; for a large page that could take a minute or more. This would happen whether or not there are errors.

So the way it works now I think is fine. Show the error if possible, in red so it stands out. But leave it to editors to recognise them and fix them. With Lua's better error reporting it should be easier to spot errors as they're generated and so quickly fix them, and it's also now much easier to find and fix errors left in articles.--JohnBlackburnewordsdeeds 02:47, 9 April 2014 (UTC)

  • Autofixing is better than save-with-errors: Even a language such as Lua should be autofixing simple errors, such as inserting "then" when omitted. With the development of computer-language design using LALR(1) grammars, the hope of the past 40 years has been to autofix the simple syntax errors and continue operation, when following the grammar production rules to find the token "then" is the only option to allow valid processing. In the case of an if-statement, it is common to detect an omitted "then" or "end" keyword which, if auto-corrected, would allow the script to continue running, and in fact generate the same results as if it cratered with "Script error" (missing "then"), was hand-fixed, and rerun. The problem arises when a user relies on auto-fixing of all syntax errors, such as always omit "then" in if-statements because they would be autofixed in every case; however, I think reality would be users who insert "then" in most cases, perhaps leaving only a few in the optional warning messages. Otherwise, this error-prone technology of fatal error messages, "You didn't say, 'Simon says'." (which craters on every small error) is an unfortunate problem well-solved over 40 years ago. -Wikid77 (talk) 08:23, 9 April 2014 (UTC)
When it's so easy to not mess up in the first place, I don't see the point of autofixing at all. It will lead to users not learning and will almost certainly introduce tons of subtle bugs. Jackmcbarn (talk) 12:03, 9 April 2014 (UTC)
autofixing of code is a very bad idea, for the reasons above and if you're autofixing, so you're inserting 'then' statements the editor omits, then it's not valid Lua. Editors should be writing valid Lua. Lua's not hard to learn, a programmer with experience in a similar language can get up to speed with it in an afternoon. It certainly doesn't present the same barrier to contributing that the arcane syntax of parser functions does.--JohnBlackburnewordsdeeds 12:18, 9 April 2014 (UTC)

Support for any browser[edit]

Another issue, for {Location_map}, is positioning the marker correctly for any browser, such as IE7 which has required the attribute "line-height:0" when setting the div-section position of the marker. The alternative Template:Location_map_quick uses that setting, as discussed in 2011, to set "line-height:0" and will position the marker very accurately on the MSIE browsers, as well as Firefox. -Wikid77 17:10, 7 April 2014 (UTC)

This discussion is a worthy one to have, but let's wait until we have resolved the script error issue first. In my experience, discussing multiple things at once makes it harder to come to an agreement. — Mr. Stradivarius ♪ talk ♪ 18:39, 7 April 2014 (UTC)
{{Location map}} does set line-height: 0;, on the end of line 153. Isn't that the same thing {{Location map quick}} does? I have no problem with adding any of this type of thing to the module. Jackmcbarn (talk) 18:53, 7 April 2014 (UTC)
I will check other aspects of the div-tags, to see if incompatible map positions are triggered in other browsers. -Wikid77 05:21, 8 April 2014 (UTC)

Loction Map+ / ~ broken?[edit]


See Wikipedia:Village pump (technical)/Archive 132#Template:Location_map~ issue.--JohnBlackburnewordsdeeds 22:56, 22 April 2014 (UTC)

Fixed. Jackmcbarn (talk) 23:12, 22 April 2014 (UTC)

Category:Location maps using skew[edit]

Can someone explain this category Category:Location maps using skew or maybe add some comment into category? I am transfering this Module into Slovenian wiki. --Pinky sl (talk) 18:39, 29 April 2014 (UTC)

skew is a rarely used, optional parameter which allows for linear variation in the spacing between latitude or longitude lines. in my opinion, this feature can be removed entirely, since we can specify arbitrary mappings using the |x= and |y=. in fact, I don't know of any actively used maps which are using the skew feature. the old Template:Location map GermanyNeckar was using skew, but that was replaced by a more general transformation (e.g., see here). Frietjes (talk) 19:47, 29 April 2014 (UTC)
Indeed, the purpose of that category is to deprecate and remove the skew feature. Once I'm sure nothing else is using it, I plan to remove the functionality and the category (and significantly simplify the x function in doing so). Jackmcbarn (talk) 01:40, 30 April 2014 (UTC)
I've added a longer description to the category page. — Mr. Stradivarius ♪ talk ♪ 05:18, 30 April 2014 (UTC)

Thanks for your answers. I can see that I will also have to update some of the old location maps. --Pinky sl (talk) 12:48, 30 April 2014 (UTC)

All the ones that I know on this WP have been updated (Template:Location map GermanyNeckar, Template:Location map SwedenCIAx, Template:Location map CanadaGeo, and Template:Location map GermanyWeser). Frietjes (talk) 15:10, 30 April 2014 (UTC)

Wrapping of labels[edit]

G'day all, I am wondering if there is a way to stop the label field from wrapping a two word place name onto a second line. I need the town name to just stay on one line. Any ideas? Thanks, Peacemaker67 (send... over) 08:20, 26 May 2014 (UTC)

@Peacemaker67: There's no special behavior in the module for it. Just do it the normal way. See WP:LINEBREAK for more details. Jackmcbarn (talk) 16:06, 26 May 2014 (UTC)
Thanks for the quick response, Jack. Never had the problem before, strangely. Gotta love that you learn something new every day on WP! Regards, Peacemaker67 (send... over) 00:09, 27 May 2014 (UTC)

Error category[edit]

Maybe it could be tracked down in some category articles with incorect coords for location maps like this case? Because normally this shouldn't happen.--Edgars2007 (talk/contribs) 15:29, 1 June 2014 (UTC)

I'm not sure. Since it's given as an example in the documentation, I'm inclined to think it was intended as a feature. Jackmcbarn (talk) 18:40, 1 June 2014 (UTC)
Yes, but don't you think that if the mark is outside of map, then something is wrong? --Edgars2007 (talk/contribs) 18:17, 3 June 2014 (UTC)
@Edgars2007: This is now in the main module. Sorry for the long delay. Jackmcbarn (talk) 20:19, 10 July 2014 (UTC)
@Jackmcbarn: Thanks! --Edgars2007 (talk/contribs) 12:38, 14 July 2014 (UTC)

Extracting the name of a map[edit]

There are some templates, and maybe some articles, which display the name of a map using code such as

Location within {{Location map {{{pushpin_map}}}|name}}

This code will break for the newer maps that have been implemented as modules instead of templates. I've never used Lua before but I have found, by trial and error, that the fix seems to be to replace the above code by

Location within {{#invoke:Location map|data|{{{pushpin_map}}}|name}}

This seems to work with both the old templates and the new modules.

I've changed a few templates to fix this:

There may well be many more instances that I haven't found. -- Dr Greg  talk  22:03, 27 June 2014 (UTC)

Next time I download a database dump, I'll run a script to find all of these. Jackmcbarn (talk) 22:09, 27 June 2014 (UTC)

Template-protected edit request on 4 July 2014[edit]

WEST MADAVILAGAM THIRUKKADAIYUR NAGAPATTINAM Dist. 609 311 Nivethanivve (talk) 12:43, 4 July 2014 (UTC)

X mark.svg Not done - adding this place to Wikipedia would need an edit to a relevant article, not an edit to Module:Location map. -- John of Reading (talk) 12:54, 4 July 2014 (UTC)

Top and bottom functions[edit]

@Jackmcbarn: related to gerrit:140763: are and p.bottom used in separate templates anywhere? I imagine that you must have split these up into separate functions to support the way the old location map templates did things, but there are too many links to find them through WhatLinksHere. — Mr. Stradivarius ♪ talk ♪ 03:11, 14 July 2014 (UTC)

@Mr. Stradivarius: That's a hack so that really big nasty pages like Template:Syrian Civil War detailed map don't blow their whole post-expand include size. Jackmcbarn (talk) 03:35, 14 July 2014 (UTC)
Hah, now that is a piece of work. That's the first time I've seen a template so big that it can't actually be transcluded anywhere... — Mr. Stradivarius ♪ talk ♪ 03:46, 14 July 2014 (UTC)
Hmm, actually it does transclude - the post-expand include size turns out to be less than the page size. But if the template keeps going at the rate it is now, I estimate that it will go over the limit in about 18 months. (Not that that's really important here.) — Mr. Stradivarius ♪ talk ♪ 08:45, 14 July 2014 (UTC)

Location map pin[edit]

Note: I've shortened the section heading, which was previously "Location map function (typically) shows a thumbnail with a pin, but then what? User expands the image to see a larger map but now the pin has gone!". — Mr. Stradivarius ♪ talk ♪ 23:34, 16 July 2014 (UTC)

Whilst many maps show regions in outline and nothing more is to be gained from expanding them, many more are city-scale and the location function is being used to locate a point of interest. The thumbnail is of limited use here, it's almost a 'teaser trailer' for a full-screen map. Unfortunately and frustratingly for the end user, the push-pin has now disappeared, making the large map almost useless.

So here is a challenge: can anyone come up with an algorithm such that the push-pin is carried forward to the expanded map, scaled appropriately. Examples to test: Victoria bus station, National Bowl#Location. --John Maynard Friedman (talk) 22:12, 16 July 2014 (UTC)

This would require some serious re-engineering of how the location maps work. I'm guessing it would require at least a new MediaWiki extension to be written, and probably some changes to MediaWiki core. It may be possible, but it certainly wouldn't be easy. — Mr. Stradivarius ♪ talk ♪ 23:34, 16 July 2014 (UTC)
@John Maynard Friedman: @Mr. Stradivarius: If bugzilla:64460 is ever fixed, it will be easy to do that. Jackmcbarn (talk) 23:55, 16 July 2014 (UTC)
There's a way to do it which in theory could be done without rewriting/extending MW. Have the link for each location map link to a special page which is the map at 800 x 600, say, with the push pin. The page would simply contain an invocation of the location map template except at that size, with links to the image's Commons page (in case that's what's needed) and back to the source article.
  • Advantage: do-able with existing software and probably without modifying the template/module
  • Disadvantage: a lot of pages need creating. A bot could create them and they'd use minimal resources but still it's still a lot of pages. Maybe they could be created on demand instead but that's probably more work than having a bot do them all at once
--JohnBlackburnewordsdeeds 00:12, 17 July 2014 (UTC)
I for one would be content to start with doing it on demand. If we find that there is a lot of take-up then it would become worthwhile for 'someone' to write a bot.
So how do you envisage creating the 800x600 map? Did you really mean adding (photoshopping) the pin on manually? And doesn't the module need to be updated so as to select the larger 'pinned' map when the thumbnail is clicked, rather than the default action? --John Maynard Friedman (talk) 10:56, 18 July 2014 (UTC)

Soccer team maps?[edit]

Hi everyone: I'm not sure if this is the right place to ask this question, but I have just begun the challenge of creating maps for first division soccer/football teams in certain countries whose pages do not have location maps, for example Chile and Costa Rica. However, when I created these maps current progress as seen on my sandbox page, they do not look attractive or legible, with many team names overlapping one another. I'd like to make them acceptable for inclusion on their respective pages. Can anyone help me with figuring out how to make them look nicer? Again, here is the link to my sandbox page.

If I haven't posted this in the right place, please let me know where I should submit my request.

Lbr123 (talk) 03:49, 20 July 2014 (UTC)

@Lbr123: Use the "position" parameter to move the labels around. Also, the wider you make the maps, the better results you'll have. Jackmcbarn (talk) 04:34, 20 July 2014 (UTC)
@Jackmcbarn: Thanks, I've tried that out but there are still lots that overlap, especially on Chile, but that could be a symptom of the shape of the country. I'll keep working on it. Lbr123 (talk) 06:08, 20 July 2014 (UTC)
@Lbr123: Between an update to the module's positioning code and some work on your maps themselves, all of the overlap is now fixed. Jackmcbarn (talk) 22:01, 9 August 2014 (UTC)

Label/marker overlap problem[edit]

Parsurameswar Temple is located in Odisha
Parsurameswar Temple
Parsurameswar Temple
Parsurameswar Temple

Spotted at Parsurameswar Temple and reproduced at right to confirm it. I had a look at a few other instances of the same template, {{Infobox Mandir}}, but this was the only one with the problem and it looks like it's nothing to do with that template.--JohnBlackburnewordsdeeds 19:34, 9 August 2014 (UTC)

And it seems to be using an odd graphic for the marker: not the usual red dot and I've not specified an override.--JohnBlackburnewordsdeeds 19:38, 9 August 2014 (UTC)
Another example of the same problem: Kapaleeshwarar Temple. The commonality is long words. I'm using Safari but it's also broken in Firefox.--JohnBlackburnewordsdeeds 20:00, 9 August 2014 (UTC)
@JohnBlackburne: I see the problem. I'm working on a fix now. Jackmcbarn (talk) 20:03, 9 August 2014 (UTC)
@JohnBlackburne: Fixed. (The unusual mark is because Template:Location map India Orissa specifies its own default mark.) Jackmcbarn (talk) 21:35, 9 August 2014 (UTC)
Looks fixed here but now some of the testcases look odd: 'Walraversijde' on a number of similar maps is so far left it's falling off the map and being clipped.--JohnBlackburnewordsdeeds 21:56, 9 August 2014 (UTC)

Location Map Belgium[edit]

Since the location map for Belgium is deleted, and I don't understand anything of 'the move to lua', how can I put POI's of the capitals of the 10 provinces onto one map? Are other maps also up for deletion (the Netherlands and its 12 Provinces f.e.)? (talk) 17:09, 22 September 2014 (UTC)

use {{location map+}} for multiple pins on one map. Frietjes (talk) 19:24, 22 September 2014 (UTC)
I use that template, but the actual map to use (Location map Belgium) doesn't exist anymore on this list.ChrisVanBommel (talk) 20:12, 22 September 2014 (UTC)
That list is out of date. The map for Belgium exists. Jackmcbarn (talk) 20:13, 22 September 2014 (UTC)
Indeed it works, I was mixing en.wikipedia and en.wikiversity. At the versity it doesn't work. Here, it does. I guess the only way to use them is to create a template at the wikiversity? Is it also with maps available at de.wikipedia I want to use at en.wikipedia, only way is create a new template, pointing to the de. version? ChrisVanBommel (talk) 20:55, 22 September 2014 (UTC)
Just copy/import Module:Location map/data/Belgium to whatever wiki you want to use it on. Jackmcbarn (talk) 20:59, 22 September 2014 (UTC)
Can somebody please elaborate on this a little more? I searched for it, and tried several things without success. Creating a page with that exact name Module:Location map/data/Belgium in the en.wikiversity, editing it, and copying whatever is available in the edit tab from the same page at en.wikipedia doesn't seem to work for me. I guess templates and modules are a little different?AalstersWolfken (talk) 18:20, 23 September 2014 (UTC)
I'm not sure what page you created, or where, but wikiversity:Module:Location map/data/Belgium doesn't exist. Also, I note that Wikiversity isn't currently using Module:Location map, so that will need to be set up there before that will work. I've asked at User_talk:Dave_Braunschweig#Location_map_import to get them imported, though. Jackmcbarn (talk) 20:18, 23 September 2014 (UTC)
@AalstersWolfken: The import is now done, so these should work there now. Jackmcbarn (talk) 02:47, 25 September 2014 (UTC)
I put up a draft of my page at It's the Module:Location map/data/Belgium I can't create. If someone can explain that a little more, I can hopefully do it myself for the 10 maps for the provinces of Belgium, available at the de.wikipedia. tia AalstersWolfken (talk) 18:16, 25 September 2014 (UTC)
@AalstersWolfken: What do you mean that you can't create it? What error do you get when you try? Jackmcbarn (talk) 03:56, 26 September 2014 (UTC)
Problem solved. Thanks for all the reactions. I actually never created a page, just tried several things, but the 'preview mode' never showed what I expected (a map of belgium, instead it showed code) and thus never saved the actual page. But now I did create a Module:page, ignored for an instant that it looked 'wrong' but it works. So thanks again. AalstersWolfken (talk) 07:48, 27 September 2014 (UTC)
Indeed, previewing new location map definitions doesn't currently work; that's bugzilla:70495. Jackmcbarn (talk) 14:58, 27 September 2014 (UTC)

Template:Location map Canada[edit]

What would be the module version of this kind of location maps? --Edgars2007 (talk/contribs) 07:09, 29 September 2014 (UTC)

@Edgars2007: Something like Module:Location map/data/Africa. Note that {{{2}}} becomes $1 and {{{3}}} becomes $2. Jackmcbarn (talk) 13:57, 29 September 2014 (UTC)
Thanks! --Edgars2007 (talk/contribs) 15:55, 8 October 2014 (UTC)

Piped name[edit]

I just made this change to fix the pipe from appearing in the caption in Birmingham Battery and Metal Company. however, now we have an unsightly (county) dab after the name. I am sure there are more of these, so it would be good to have a strategy for finding/fixing this issue. Frietjes (talk) 15:29, 19 October 2014 (UTC)

note that this one can be fixed by changing it to West Midlands county, which is better, since it's not a link to a disambiguation page, and it doesn't have the trailing disambiguation parenthetical, but again, I am sure there are others. Frietjes (talk) 15:32, 19 October 2014 (UTC)
As I understand it, the purpose of the name parameter is to provide a text description of the map location, suitable for appearing in phrases such as "shown within name" or "located in name". As such, it doesn't need to be the name of an article. For example, I've created maps where the name is "Preston city centre" or "the Borough of Wyre", where we don't have articles with those exact names. If there's a need for a link to an article as well, maybe there should be a separate parameter to achieve that (which would default to name if not set)? -- Dr Greg  talk  16:21, 19 October 2014 (UTC)
that would work. we just need to avoid linking to 'West Midlands' since it's a disambiguation page. Frietjes (talk) 16:31, 19 October 2014 (UTC)


Any ideas regarding the retrieval of coordinate information from wikidata? An edit was made to Module:Coordinates, and I made subsequent changes in the sandbox to fix some bugs (see Module talk:Coordinates), but maybe editors of this module would be interested, as well? —PC-XT+ 06:10, 23 October 2014 (UTC)

@PC-XT: I set up the sandbox to do this. If you don't see any problems, I'll add it to the main module. Jackmcbarn (talk) 20:03, 23 October 2014 (UTC)
Jackmcbarn, I haven't found any problems. It looks good. —PC-XT+ 03:39, 24 October 2014 (UTC)
@PC-XT: Yes check.svg Done Jackmcbarn (talk) 14:06, 24 October 2014 (UTC)

Understanding Location map coordinates[edit]

In Akashi Kaikyō Bridge, {{Location map}} is coded as the value of |extra= in {{Infobox bridge}}. While converting the deprecated |coordinates= in the infobox, I removed the coordinates values from {{Location map}} to see if it would obtain the coordinates from the infobox. The map did not change, the marker is still displayed correctly.

First, if the map can obtain the coordinates from the infobox, I'm wondering why the doc doesn't say anything to that effect.

Further, when I altered the infobox longitude by 30 degrees, the map marker didn't move.

What's going on here? ‑‑Mandruss  11:43, 9 November 2014 (UTC)

Mandruss it is pulling the coordinates from d:Q184213. Frietjes (talk) 18:02, 9 November 2014 (UTC)
by the way, this is a better fix. Frietjes (talk) 18:04, 9 November 2014 (UTC)
Thank you. ‑‑Mandruss  22:08, 9 November 2014 (UTC)


Is there any way to draw a line between two or more points?--عبد المؤمن (talk) 15:55, 5 December 2014 (UTC)

Also, is there any way to not use a marker and have the text centred on the coordinates?--عبد المؤمن (talk) 18:41, 5 December 2014 (UTC)

@عبد المؤمن: To your first question, there's not really a good way to do that right now. The best way is currently Template:Location map-line, but it's extremely limited. At some point in the future, Scribunto will get the ability to generate .svg files, and then it will be easy to do that. To your second question, no, there's no such way to do that. What would the use case for it be? Jackmcbarn (talk) 03:32, 7 December 2014 (UTC)
@Jackmcbarn: Thanks. The use of my second suggestion would be to label regions, deserts, mountain ranges, seas, continents etc. where a marker shouldn't really be used --عبد المؤمن (talk) 13:25, 7 December 2014 (UTC)
@عبد المؤمن: You can hide the marker by setting marksize to 0. The label itself will be slightly off-center, but for that use, that shouldn't be a problem, and you can mitigate it by setting the label position to top or bottom. Jackmcbarn (talk) 15:07, 7 December 2014 (UTC)

Template-protected edit request on 13 December 2014[edit] (talk) 17:11, 13 December 2014 (UTC)

X mark.svg Not done. You need to say exactly what change you want made.--JohnBlackburnewordsdeeds 17:18, 13 December 2014 (UTC)

Link=, Mouseover does not work[edit]

Location map is located in Caucasus mountains
noBrak NoMark
noBrak NoMark
Location map
NoBrak NoMark LinkHi
NoBrak NoMark LinkHi
Brak NoMark
Brak NoMark LinkHi
TEST2:Date of Russian annexation. Mouseover for name

GOAL:label=year, link=mouseover shows name and goes there; mark=some kind of group

Correct: ShowLink, GotoLink (after Mouseover)
Link=Bracket: ShowLink, Go2Mark
Link= noBrak:ShowLabel,Go2Link
BUT:ShowLink, GotoLink (only?) if link=bracketed label (see lower left Derbent)

Workaround: label=[*[ article, bar, label ]*] (see lower right)

Link= mouseover does not work?: I found a workaround, but there appears to be an error in your code. The article to this talk page says "link" "Specifies a wiki link which will be followed if the reader clicks on the mark. The name of the linked article is displayed when the mouse pointer hovers over the mark." As near as I can tell this only works if {link=X|label=[*[X]*]} (ignore the asterisk). Without this: 1. Clicking the mark will take you to the article, but mouseover will show the label=. 2. If you write link=[*[X]*], mouseover will show the link name, but clicking on the mark takes you to mark=. Either that or I misunderstand something. Workaround is to write label=[*[ article, bar, label ]*].

I don't know what to do about the code, but I suggest you note the problem in the article. It would save the next person the 6 hours I spent finding a workaround. (Obviously my fault but some people are dumber than I am.) A quick way might be to patch the USA map with {*{Location map~| USA | label = Mouseover this Label| position =bottom| mark=X solid black 17.gif|marksize=15|lat_deg = 39.1| lat_dir = N| lon_deg = 94.6 | lon_dir = W }*} or whatever might work. Benjamin Trovato (talk) 00:38, 5 January 2015 (UTC)

@Benjamin Trovato: The code is working correctly. The documentation was wrong, though I've now fixed it. See if it makes more sense now. It's actually the label that determines the alt text if it's set. Also, you shouldn't use [[]] around the value of link=. Jackmcbarn (talk) 19:09, 6 January 2015 (UTC)
Good. Under link you might also say that a link can also be embedded in a label (for crossreference), 2. Yellowstone National Park to Paris or whatever (too many characters). Benjamin Trovato (talk) 11:10, 8 January 2015 (UTC)

Template-protected edit request on 27 January 2015[edit]

can you please put and insert an existing map of (Autonomous Region of Kurdistan) (Iraqi Kurdistan) (federal region of Kurdistan) (Kurdistan Region) in here, Ajin.duhoki (talk) 17:26, 27 January 2015 (UTC) more 7 million people will appreciate the Idea of them being referred to as an Kurdistan autonomous region of Iraq rather than simply Iraq. thanks in advance and we get it if you can't.

I'm going to need a map. Can you upload a free map?—cyberpowerChat:Limited Access 17:54, 27 January 2015 (UTC)
I'm closing this since nothing about it actually needs a template editor. Anyone can set up a new map themselves by following the instructions at Template:Location map/Creating a new map definition. Jackmcbarn (talk) 23:25, 27 January 2015 (UTC)

Documentation problem?[edit]

This request has not been answered, contrary to box at right. Benjamin Trovato (talk) 20:50, 3 February 2015 (UTC)

Parameters section says: "Required. Use the name of the map as the first unnamed parameter". As I understand it "name of the map" should be "map template" or whatever it's called. For example "Russia Dagestan relief locator map.png" requires "Russia Dagestan" in locator map code and "Caucasus topo map-blank.svg" requires "Caucasus mountains". Apparently the way to find these is to double click the map, go down to 'file usage' and find somewhere "Template: Locator map XX" and use the "XX". You sometimes have to use the view button at the bottom to get down far enough to find the template. Is there something that directly associates a map with its template? I probably misunderstand something, but documentation should prevent misunderstanding where possible.Benjamin Trovato (talk) 20:27, 3 February 2015 (UTC)

  • #2 When I loaded this I got a pop-up saying 'this request has been answered', which is an error of some kind. It mentioned setting answered=, but no indication of where to find this. Benjamin Trovato (talk) 20:45, 3 February 2015 (UTC)
    @Benjamin Trovato: The answered request box is referring to the section above this one. The way that you found to associate a map image with its template is correct. Another way is to look at the page's source code. There's no easier way. Jackmcbarn (talk) 21:15, 3 February 2015 (UTC)

Detecting missing parameters, and illogical combinations[edit]

I want to incorporate the following code:

|11000000|00110000|00111100|00111111=<!-- valid combinations - do none -->
|#default=[[Category:Location map parameter errors]]
}}{{#ifeq:{{#if:{{{lat_dir|}}}|1|0}}|{{#if:{{{lon_dir|}}}|1|0}}|<!-- valid combination - do none -->|[[Category:Location map parameter errors]]}}

But I have no idea how to do it in Lua. --Redrose64 (talk) 12:29, 4 February 2015 (UTC)

@Redrose64: I set this up, but with the generic error category instead of a new one, and also with visible messages explaining exactly what the problem is. Jackmcbarn (talk) 18:45, 4 February 2015 (UTC)
Jackmcbarn, are you checking for 'lat_sec' without 'lon_sec', e.g., |lat_deg=39|lat_min=56|lat_sec=5|lat_dir=N|lon_deg=32|lon_min=52|lon_dir=E that's the issue that prompted this thread. Frietjes (talk) 20:58, 4 February 2015 (UTC)
@Frietjes: No. How is that invalid? Jackmcbarn (talk) 21:00, 4 February 2015 (UTC)
Jackmcbarn, see this thread. the bot did this, which would have been detected in a tracking category had we had a check for 'lat_sec' without 'lon_sec'. no need to issue an error, just a tracking category. Frietjes (talk) 21:03, 4 February 2015 (UTC)
@Frietjes: I think a tracking category for that would be impractical, since lat_sec without lon_sec is valid in a lot of cases. Jackmcbarn (talk) 21:04, 4 February 2015 (UTC)
Jackmcbarn, how about trying it, then seeing if there are a significant number of false positives in the category? I can tell you already that there will be at least 400 based on the list in User:Frietjes/d. seems a lot easier than having a bot scan every transclusion of this module to check. Frietjes (talk) 21:08, 4 February 2015 (UTC)
(edit conflict) It's not picking up Camnago-Lentate railway station, Carimate railway station, Carnate-Usmate railway station, Cassano d'Adda railway station, Ceriano Laghetto-Groane railway station, and plenty more. By my code above, all of these should yield 00111110, which is not one of my four valid combinations. If you consider latitude in isolation from longitude, this would technically be a valid combination, but that was not my intention. My intention was to take latitude and longitude together and ensure that if a parameter for one component of latitude was given, the same component for longitude was also given, and vice versa. In all those example, one parameter pair is imbalanced: there is a |lat_sec= (two of them in most cases) but there is no corresponding |lon_sec=. I know that there are lots more like it, because I've turned up dozens in the last few days. They were caused by at least two sets of bad template documentation, which in some cases (estimated to be 1 in 60) was compounded by a good-faith but incorrect edit by SporkBot (talk · contribs), see User talk:Plastikspork#Wrong action for duplicate template args. What I am trying to do is find those pages which have two |lat_sec=, and no |lon_sec= - and fix them to have one of each. --Redrose64 (talk) 21:11, 4 February 2015 (UTC)
@Redrose64 and Frietjes: I just set up Category:Location maps with different longitude and latitude precisions containing the issue you're talking about. Note that the sortkey identifies which parameter is different (H for hemisphere, aka N/S/E/W). Jackmcbarn (talk) 02:20, 5 February 2015 (UTC)
thanks, already used this correct a dozen of them, including unrelated problems like this. Frietjes (talk) 22:01, 5 February 2015 (UTC)
I have now fixed all but three of the several hundred pages in Category:Location maps with different longitude and latitude precisions - it was useful for detecting typos like |last= for |lats=. The three remaining pages are testcases where the precision is intentionally different. --Redrose64 (talk) 15:48, 27 February 2015 (UTC)

Odd problem with Infobox mountain[edit]

{{Infobox mountain
| name = Cape Mountain
| photo = 
| photo_caption = 
| elevation_ft = 2289
| elevation_ref = 
| prominence = 
| map = Alaska
| map_caption = Location in Alaska
| map_size = 250
| label_position = right
| location = [[Seward Peninsula]], [[Alaska|Alaska, U.S.]]
| range = 
|coords = {{coord| 65.5763889 | -168.0075 |region:US-CA_type:mountain|display=inline,title}}
| coordinates_ref = <ref>[]</ref>
| topo = 
| type = 
| age = 
| first_ascent = 
| easiest_route = 

This is an odd one. Why does this infobox, copied and pasted exactly, not work here but it works in its article Cape Mountain? It's arising after the recent changes, possibly something odd about the way {{Infobox mountain}} is drawing a map but I can't tell what.--JohnBlackburnewordsdeeds 20:16, 8 February 2015 (UTC)

JohnBlackburne in the article, it is pulling the coordinates from WikiData (see d:Q14951206). here, there are no coordinates on WikiData. Frietjes (talk) 20:24, 8 February 2015 (UTC)
Ah, thanks. I didn't realise, and hadn't noticed, as I had to update the coordinates to correct the location which was putting it in the ocean. Didn't realise the map was ignoring these altogether. I've updated the Wikidata coordinates so the map is actually correct.--JohnBlackburnewordsdeeds 21:31, 8 February 2015 (UTC)
Now that the issue has been figured out, I've disabled the above code to avoid a script error being here forever. Jackmcbarn (talk) 23:34, 8 February 2015 (UTC)

Switching in Module:Location map/multi[edit]

Is it possible to enable switching option in Module:Location map/multi? --Edgars2007 (talk/contribs) 16:14, 12 March 2015 (UTC)

@Jackmcbarn: --Edgars2007 (talk/contribs) 18:21, 16 April 2015 (UTC)
Switch between what? Alakzi (talk) 18:50, 16 April 2015 (UTC)
This one. --Edgars2007 (talk/contribs) 18:53, 16 April 2015 (UTC)
@Edgars2007: Yes check.svg Done Sorry for the delay. Jackmcbarn (talk) 19:41, 16 April 2015 (UTC)
It's ok. Thanks --Edgars2007 (talk/contribs) 19:45, 16 April 2015 (UTC)

location limitation?[edit]

Is there a limitation in how many locations I can have in one map? It looks like I've reached the limit [1], if so how can I eventually remove the limit? No points are showing on the map in this edit, but the one before shows all points, [2]. --Ahmetyal (talk) 22:58, 18 April 2015 (UTC)

@Ahmetyal: The module itself doesn't define any limit, but the MediaWiki parser effectively makes one. When you want to use as many points as you are, you're better off using a data module for the points, like Template:Syrian Civil War detailed map does. Jackmcbarn (talk) 04:08, 19 April 2015 (UTC)
For the given example, if you remove the last three points, it then displays all of the others. --Redrose64 (talk) 07:44, 19 April 2015 (UTC)
Thanks for the reply. @Jackmcbarn: is this the right wat to request a move: [3]? --Ahmetyal (talk) 09:29, 19 April 2015 (UTC)


@Jackmcbarn: If switcher is used and caption is defined, both of them are showing. I think that in such cases caption should be disabled. --Edgars2007 (talk/contribs) 15:59, 8 May 2015 (UTC)

@Edgars2007: I don't see what the problem is. Can you clarify? Jackmcbarn (talk) 16:04, 8 May 2015 (UTC)
Ok, this will be a better example: Fountains Abbey. IMO, the caption (Location of Fountains Abbey and Studley Royal Water Garden in North Yorkshire) should be disabled in module, when you're using multiple location maps. And the caption in this case is actually wrong, when you're viewing map of England :) --Edgars2007 (talk/contribs) 16:14, 8 May 2015 (UTC)
The caption is generated independently in the infobox. These are two separate issues. Alakzi (talk) 16:30, 8 May 2015 (UTC)
Indeed, it appears that there's nothing to fix in this module. If a caption doesn't make sense, it just shouldn't be specified. Jackmcbarn (talk) 16:41, 8 May 2015 (UTC)
S*, yes, it isn't in the location map template :( OK, sorry then. Alakzi, I think there could be some more infoboxes, that should have this change. And this kind of style is used in much more, I think. --Edgars2007 (talk/contribs) 05:59, 9 May 2015 (UTC)
Infobox thumbnail captions need revamping, least of all so that they are shown in Media Viewer. Shoving captions into hardcoded <div>s is hardly ideal. Alakzi (talk) 14:06, 9 May 2015 (UTC)

"name" parameter[edit]

It's my understanding that the {{{name}}} parameter of each map's own defining module or template is intended to be used within a default map caption and/or alt text when no explicit caption is supplied by the transcluding article. There's no requirement, as far as I can tell, that this parameter should be the name of an appropriate article. (That requirement would conflict, in some cases, with the previously mentioned intention; see below for an example) Yet when you view the module or template directly, the table that summarises the data wikilinks the name parameter. This can result in an unintended red link or to a link to a disambiguation page. Can the code that generates this table (wherever that is(?)) be modified not to link the name?

An example of this is Module:Location map/data/United Kingdom Preston. In my view, the correct {{{name}}} for this is simply "Preston", but this generates an unwanted link to the disambiguation page Preston. I don't want to replace "Preston" by "Preston, Lancashire" because that would generate some unnecessarily verbose map captions; in the articles where this map appears, disambiguation isn't necessary as other information in the article makes it clear which "Preston" is being referred to. -- Dr Greg  talk  18:27, 2 July 2015 (UTC)

@Dr Greg: Should be fixed now. Jackmcbarn (talk) 18:41, 2 July 2015 (UTC)
@Jack: See Fernyhalgh Wood. Alakzi (talk) 19:02, 2 July 2015 (UTC)
(edit conflict) Though the doc page links to it, {{Location map}} doesn't link to the name out of the box. At some point, somebody must've customised the caption in one of the very many infoboxes this template's used to wikilink to the name; consequently, to bypass a disambiguation page, an imaginative editor must've thought to pipe the name, as is done in Template:Location map Spain Basque Country. This workaround proliferated, and the rest, as they say, is history.
Someone's gonna have to go through all of these map definitions to get rid of the pipes, as well as all of the infoboxes to unlink the name. Alakzi (talk) 18:54, 2 July 2015 (UTC)
(edit conflict) Thanks, @Jackmcbarn:, that seems to work for modules, but not for templates.
Unfortunately, I have now just discovered that Template:Location map Scotland Highland has a piped name Highland (council area){{!}}Highland, which is expecting to be linked. Which is the correct specification for what {{{name}}} is supposed to be?
I wrote the above sentences before Alakzi's reply. (Can we do something clever to detect the presence of a pipe character?) An example of a "misbehaving" infobox is {{Infobox UK feature}}. -- Dr Greg  talk  19:13, 2 July 2015 (UTC)
Only 16 of them in the Template namespace. Alakzi (talk) 19:27, 2 July 2015 (UTC)
And these are all of the infoboxes which link to the name. Alakzi (talk) 19:30, 2 July 2015 (UTC)

──────────────────────────────────────────────────────────────────────────────────────────────────── @Dr Greg and Alakzi: I added logic to the module to detect pipes in names. It will populate the "N" sortkey of Category:Location maps with possible errors. Note that it will take some time to fill due to the job queue. Jackmcbarn (talk) 22:06, 2 July 2015 (UTC)

That was probably all of them; I don't think there's any in Module: definitions. Alakzi (talk) 22:48, 2 July 2015 (UTC)

points show as lines[edit]

I'm trying a fairly simple use of this template in my sandbox but all the points (using map-) show as vertical lines. It would seem that the vertical scale is not being set correctly. On that page are 4 examples: the 2nd two are copied from other pages and show the template working properly and in the first example with the same map. So can someone tell me what I'm doing wrong (in the first two)? Chris55 (talk) 20:06, 18 July 2015 (UTC)

This happened to me once before. You need to use '~' not '-'. See Module talk:Location map/Archive 6#Can't get a map of County Durham to work. I've fixed in in your tests to confirm. This is really not obvious, especially as it looks like something else is happening such as a missing coord.--JohnBlackburnewordsdeeds 20:14, 18 July 2015 (UTC)
Thanks John - couldn't see that!!! Thought it must be something simple. Where the heck do those lines come from?? Chris55 (talk) 20:54, 18 July 2015 (UTC)
I see now I was misled by the documentation. There are 6 examples of "location map-" on that page and only one of "location map~". Chris55 (talk) 22:03, 18 July 2015 (UTC)
What documentation is that? There shouldn't be any of those anywhere. Jackmcbarn (talk) 22:08, 18 July 2015 (UTC)
Actually I see it is the abysmal font used on my browser (Firefox 39 Ubuntu) for the documentation on Template:Location map+. It is indeed a ~ but one could never tell. Looking at it on another platform I can see it. Chris55 (talk) 22:14, 18 July 2015 (UTC)
In my case it’s Safari. In the edit window ~ and - are easy to mistake. The tilde looks almost flat, and on its own is not obviously longer. Plus it’s a rare character not often used in English or in programming languages. So if you look at the source for an example then manually retype it in yours you can get it wrong. Especially as it almost works, but looks like something else has gone wrong such as the x coord being missing. It does not surprise me Firefox also having problems as it has known issues displaying the proper fonts on many pages.--JohnBlackburnewordsdeeds 22:23, 18 July 2015 (UTC)
I've RfD'd the problematic template, since it isn't currently being used for anything and it does cause this sort of confusion. Jackmcbarn (talk) 22:24, 18 July 2015 (UTC)

Delta Plan[edit]

Hello. I would like to create a map like for the Delta Plan which would be the translation of fr:Modèle:Carte/Plan Delta or nl:Sjabloon:Zijbalk Deltawerken, but I don't know how to start it. Can someone help me ? I guess I have to create Template:Location map Delta Plan, or Module:Location map/data/Delta Plan but there is always something wrong, the creation is always refused, it says "To preview another page with this template, a page title must be specified." I don't understand I wrote a title in it.--Io Herodotus (talk) 05:36, 7 September 2015 (UTC)

Yes check.svg Done Just one thing, on Module:Location map/data/Delta Plan, the map doesn't show. Perhaps it doesn't matter as long as Template:Delta Plan works. --Io Herodotus (talk) 20:52, 7 September 2015 (UTC)
Someone kindly fixed it.--Io Herodotus (talk) 07:38, 8 September 2015 (UTC)

Disable links and enable tooltip[edit]

Hey. On this article, is there a way to disable the ability to click on the location map itself? In other words, the only link on the map is the pogs, not the map itself. Also on a separate note, is there a way to fix the tooltips that show when you hover on the pogs? For example, when you hover on any of the green or red pogs, the tooltip shows as List of dams and reservoirs in Sri Lanka. I want that to change to the name of the link, or if that is not possible, a custom text instead of the current article name. Can anyone help? Thanks in advance! Rehman 12:22, 15 November 2015 (UTC)

Rehman, try setting |maplink= but leave it blank. Frietjes (talk) 23:16, 17 November 2015 (UTC)
Thanks Frietjes, you're a genius! Any clue if the tooltip thing is possible? Rehman 13:34, 18 November 2015 (UTC)
Rehman, two options, |alt= and |link=. the alt parameter will override the entire alt text. the link parameter will override the first part of it. Frietjes (talk) 15:00, 18 November 2015 (UTC)
It doesn't work for some reason. Adding the alt text doesn't change the tooltip text when hovering over the pogs... Rehman 00:06, 19 November 2015 (UTC)
Managed to find a solution. Thanks! Rehman 05:28, 21 November 2015 (UTC)

Mis-plotted coordinates?[edit]

Dear map experts:

I just updated a pair of geo coordinates in 3 separate places in the markup for the article T. A. Gillespie Company Shell Loading Plant explosion, and also in its Wikidata link d:Q7668106. I wasn't sure from the documentation: Are all 4 copies of the coordinates necessary to keep everything working consistently? Or is there a way to avoid having to maintain multiple copies?

According to Google/OpenStreet/Bing/etc, now the location is plotted correctly when I view the article and click on the numerical coordinates that display above or inside the infobox – but the template map below the infobox is plotting the location incorrectly (west of highway US 9, rather than east, and a bit too far north, leaving it about 2 miles off). Is it possible that the template map is mis-calibrated, or is something else going wrong? How can this be fixed? (In the article's wiki markup, I added a comment specifying a different template that shows the location correctly.) —Patrug (talk) 08:04, 3 January 2016 (UTC)

@Patrug: The problem was that you specified the map name as New Jersey, but specified Location map of Middlesex County, New Jersey.svg as the AlternativeMap. You can only use AlternativeMap for different colorings of the exact same area, but in this case, the area was totally different. The fix was to use USA New Jersey Middlesex County as the map name, which uses the map you want as the default. Also, all of the templates can pull the coordinates from Wikidata, so I removed the parameters here. Jackmcbarn (talk) 19:49, 3 January 2016 (UTC)
@Jackmcbarn: Ah, thanks for the explanation and the quick fix. (I'll alert the editor who added the mismatched maps a year ago, and I'll watch for other articles that might have similar problems.) Can the "coord" template itself pull coordinates from Wikidata? We should probably add some basic documentation about Wikidata coordinates to all the relevant template pages? —Patrug (talk) 07:02, 4 January 2016 (UTC)
Module:Coordinates looks at Wikidata, but I can't get it to use it. When I have more time, I'll dig more into it. Yes, it would be a good idea to document how things interact with Wikidata. Jackmcbarn (talk) 04:02, 5 January 2016 (UTC)

Template talk:Infobox civil conflict[edit]


Anyone familiar with implementing location maps into infoboxes? I feel this infobox would be a great candidate. I tried to do it myself, but couldn't get it to show a map in previews. Jolly Ω Janner 23:05, 16 January 2016 (UTC)

It appears that it does support it, but I just didn't know how to use it in an article. My mistake. Jolly Ω Janner 00:27, 17 January 2016 (UTC)