Jump to content

Module talk:Location map/Archive 7

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
Archive 1Archive 5Archive 6Archive 7Archive 8Archive 9Archive 10

Transcluding missing modules

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"

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

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)

Location_map templates deleted

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)

Support for any browser

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)

Avoiding script errors

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
Imotski {Location map}
Result from {Location map quick}

{{Location map/sandbox quick| Croatia | lat = 43.44 | long = 17.21 | label = Imotski | position = right | background = #FFFFDD | width = 180 | float = left | marksize=4 | caption = in {Location map quick} | alt = Imotski is in Croatia. }}



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

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

Result from {Location map quick}

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

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

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 391: The value "17.x" provided for longitude is not valid.

Autofixed in {Location map/new2}
Imotski is located in Croatia
Imotski
Imotski
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

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)

Loction Map+ / ~ broken?

Resolved

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

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

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)

Extracting the name of a map

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

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

 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

@Jackmcbarn: related to gerrit:140763: are p.top 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)

Error category

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)

Location map pin

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)

Label/marker overlap problem

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)

Soccer team maps?

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)

Location Map Belgium

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.)?78.21.252.160 (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 https://wiki.riteme.site/wiki/Template:Location_map/List 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 https://en.wikiversity.org/wiki/User:AalstersWolfken/sandbox. 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

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

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)

Wikidata

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:  Done Jackmcbarn (talk) 14:06, 24 October 2014 (UTC)

Understanding Location map coordinates

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)

Lines

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

81.132.46.54 (talk) 17:11, 13 December 2014 (UTC)

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

Link=, Mouseover does not work

Location map/Archive 7 is located in Caucasus Mountains
noBrak
noBrak
noBrak NoMark
noBrak NoMark
Location map/Archive 7
NoBrak NoMark LinkHi
NoBrak NoMark LinkHi
Brak
Brak
Brak NoMark
Brak NoMark
Location map/Archive 7
Brak NoMark LinkHi
Brak NoMark LinkHi
BrakTrick
BrakTrick
simplest
simplest
Wanted
Wanted
noLink
noLink
BackG
BackG
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

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?

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)

Odd problem with Infobox mountain

{{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>[http://www.satelliteviews.net/cgi-bin/g.cgi?fid=1399900&state=AK&ftype=summit]</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)