Jump to content

Module talk:Location map/Archive 10

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

Edit request: Remove /sandbox from Module:Location map/multi

Last edit[1] had local locmap = require('Module:Location map/sandbox'). The /sandbox should be removed again. Christian75 (talk) 16:22, 23 February 2018 (UTC)

 Done Galobtter (pingó mió) 16:44, 23 February 2018 (UTC)
@Frietjes: looks like the sandbox had got out of sync slightly with the main module, hence the unexplained removals (and also the require being a sandbox version). Bellezzasolo Discuss 20:23, 23 February 2018 (UTC)
Bellezzasolo, yes, your diffs didn't ask for these removals, but when the sandbox was copied, that's what happened. I noticed because there was an explosion in the number of articles generating script errors, but we seem to be doing better now. Frietjes (talk) 20:26, 23 February 2018 (UTC)

Proposed changes

I've made a change over at the module sandbox. This is the inclusion of a new parameter - |excludefrom=. When set, the mark in question is excluded from the specified maps. The syntax for specifying maps is as usual. This is only useful in the context of multiple maps - either some of multiple marks are off the screen, or you have a map of a town, and you don't really want a dot saying that town's name slap bang in the centre - but you do want a map of the country. Bellezzasolo Discuss 07:22, 26 February 2018 (UTC)

Bellezzasolo I do like the idea of supporting a static image without a locator pin (see this thread). there was also some discussion of having |first_valid= and/or |only_valid= parameters which would (1) only show the first valid map and (2) only show the valid maps. a map is valid if the pin is on the map. this would be useful for Template:Infobox telescope which uses Template:Wikidata location map at the moment, but has problems with telescopes in Hawaii since they aren't on the main USA map. I don't see the point of showing maps that don't include any pins, unless these are static images that aren't location maps. Frietjes (talk) 16:48, 26 February 2018 (UTC)
@Frietjes: I was thinking in the context of {{Location map+}} mainly. There it has its uses, I think. Bellezzasolo Discuss 16:51, 26 February 2018 (UTC)
Bellezzasolo can you provide an example in an article? Frietjes (talk) 16:53, 26 February 2018 (UTC)
Frietjes e.g. University of Oxford#Map, which is tested with the new changes over at {{Location map+/testcases}} Bellezzasolo Discuss 17:14, 26 February 2018 (UTC)

Multiple maps layout error

A problem was reported at Wikipedia:Help desk#Incorrect page layout. The example at Template:Location map#User selection of multiple maps displays the radio buttons to the left of the map instead of below. PrimeHunter (talk) 13:21, 4 March 2018 (UTC)

Rabindranath Tagore was using Template:Location map+ with multiple maps. I've fixed the article, but there probably could be some improvements to the templates to detect this. (I don't believe we have any intention of supporting multiple locations and multiple maps simultaneously.) MB 14:38, 4 March 2018 (UTC)
@PrimeHunter and MB: I will see about adding some tracking for this, and then (possibly) a method for correcting it. see Toggle options appear in the wrong place and Multiple maps without an infobox. Frietjes (talk) 15:04, 4 March 2018 (UTC)
The example at Template:Location map#User selection of multiple maps still looks wrong to me but I don't know whether it does something unsupported. PrimeHunter (talk) 15:19, 4 March 2018 (UTC)
see Toggle options appear in the wrong place and Multiple maps without an infobox. Frietjes (talk) 15:46, 4 March 2018 (UTC)

Captions - suggested change

I sometime encounter code like Template:Wikidata location map.

Location of {{#if:{{{name|}}}|{{{name}}}|{{PAGENAMEBASE}}}}

This is problematic when it comes to multiple maps. As a result, I'd suggest supporting caption templating like Module:Location map/data/USA utilizes in the x and y parameter.
Something like |caption=Location in $name. Bellezzasolo Discuss 23:21, 10 March 2018 (UTC)

Bug with most recent changes

@Bellezzasolo: not sure what happened, but comparing

the sandbox version (which is the version before I rolled back) has the map spilling out of the infobox. I will see if I can figure out what went wrong. Frietjes (talk) 22:02, 29 March 2018 (UTC)

it looks like it's triggered by the additional outer <div>...</div> Frietjes (talk) 22:04, 29 March 2018 (UTC)
Bellezzasolo, I think I found the problem. {{infobox protected area}} uses |default_width= and |max_width=, but the code that you added was ignoring these values. I moved the width determination code to a subfunction and added some more logic, and it seems to have fix the problem diff. but, we probably need more testing? Frietjes (talk) 22:28, 29 March 2018 (UTC)
Yeah, although I’m not sure about what some good testcases would be. Ideas? Bellezzasolo Discuss 22:31, 29 March 2018 (UTC)

Help sawiki

I tried importing this module to sawiki (latest code) but it has 100s of module dependencies. It is very difficult to import all associated countries / states / cities to sawiki manually. Can someone please help. Capankajsmilyo (talk) 02:39, 3 April 2018 (UTC)

Capankajsmilyo, I would suggest asking at WP:BOTREQ. basically, you want a bot to import the maps. or, at least the most common maps. the other option is to add them one-at-a-time as you need them. Frietjes (talk) 12:34, 5 April 2018 (UTC)
Thanks, Ive posted bot request. Hope to get a response soon. Capankajsmilyo (talk) 09:14, 15 April 2018 (UTC)

Further help

This contains a function coords2text which needs input as arabic numerals. In sawiki we pass devanagari numerals. Please help... Capankajsmilyo (talk) 09:14, 15 April 2018 (UTC)

@Capankajsmilyo: What you need there is a function that converts one format to the other - split the string into an array, and convert each character individually is a common approach. Bellezzasolo Discuss 10:56, 15 April 2018 (UTC)
Will Module:GetLocalDigits work? How to integrate? And decimals and non-numerals? Capankajsmilyo (talk) 12:20, 15 April 2018 (UTC)
@Capankajsmilyo: see bn.wiki. আফতাব (talk) 14:17, 15 April 2018 (UTC)
Trappist the monk has done recent work I think on this for the citation templates. He may be able to help. --Izno (talk) 18:41, 15 April 2018 (UTC)
The bn.wiki example mentioned above shows how digit translation is done. I don't think that I have anything further to add.
Trappist the monk (talk) 18:53, 15 April 2018 (UTC)

Help Pawiki

I tried importing this module to pawiki (latest code) but when i saw an article, it shows "Lua error in Module:Location_map at line 418: No value was provided for longitude." How can i fix this error? - Satpal Dandiwal (talk) 13:53, 3 June 2018 (UTC)

First, provide a link to the article that has the error in it so that we have a chance to help you. Second, is the article using the {{coord}} template in the infobox? If not, add the coord template to the infobox using the |coordinates= parameter to see if that fixes the problem. – Jonesey95 (talk) 15:04, 3 June 2018 (UTC)
Hello @Jonesey95, here is an article - ਮੈਟਰੋਪੋਲੀਟਨ ਮਿਊਜ਼ੀਅਮ ਆਫ਼ ਆਰਟ - Satpal Dandiwal (talk) 16:09, 3 June 2018 (UTC)
There are a few problems here. Template:Infobox museum does not pass |coordinates= to Template:Location map+. Fix that. Also, Template:Location map+ uses Template:Location map/multi, which does not accept |coordinates=. Update those things and then try it again. – Jonesey95 (talk) 16:24, 3 June 2018 (UTC)

Issues when using div tags

I don't know when or why this happened, but recently place labels in top or bottom positions that were modified with any sort of <div> tag show up far away from the corresponding marker (see an example at 2018–19 Bundesliga). Could someone look into this? Phanto1999 (talk) 10:27, 12 July 2018 (UTC)

@Phanto1999: See Wikipedia:Village pump (technical)#Location Map Template Issues. In short, this is incorrect formatting. Jc86035 (talk) 10:39, 12 July 2018 (UTC)

Issue with background labels

Team Wiki,

As per the previous section and Village Pump, I'm starting to see undesirable results with labels on maps.
Seemed to start presumably since the the Tidy to Remex change or the last edit to the module, not sure which.
The background parameter on top and bottom labels is either not fully highlighting the text, or has extra padding.
See the map on the List of settlements in South Yorkshire by population page for an example.
As way of a workaround I can add a label_width parameter which I can use to resize said background to fit the text.
But there are many pages which have maps which I would need to change, is it better I wait for a global fix (with Remex) or is it the module change, which I doubt.
Regards
--22:02, 30 August 2018 (UTC)The Equalizer (talk)

The Equalizer, can you be more specific concerning the List of settlements in South Yorkshire by population example? I am not seeing any serious problems there, but I may be missing something. Frietjes (talk) 19:28, 31 August 2018 (UTC)
okay, I see what happened. when Ahecht changed the span tag to a div tag here, it stopped acting like an inline element. I have added display:inline which seems to fix the problem for me. let me know if you still see problems. Frietjes (talk) 19:35, 31 August 2018 (UTC)
Thanks Frietjes. I sandboxed that changes against as many uses of the template that I could find, but obviously missed this edge case. --Ahecht (TALK
PAGE
) 22:19, 31 August 2018 (UTC)
Ah yes, this latest tweak has done the trick so a huge thanks to you both.
Could I propose a further issue along those lines. On the List of settlements in Somerset by population page by way of example. The left and right double height labels on the map there (Shepton Mallett & Burnham-on-Sea) get extra padding to the sides, is that too a 'feature'? I can work around those quite easily as subsequent nearby labels can overlay that padding, or I can label_width it into a single line, but there are times where it comes in handy; the label over two lines allows you to fit other labels closeby, especially on a crowded map.
So I wonder whether if it could be made more fitted to the text.
Note this was a feature not caused by any recent edits, it works but could be improved.
Many thanks for your assistance here team.
The Equalizer (talk) 08:56, 1 September 2018 (UTC)
There is a triple line example at List of settlements in Kent by population - the ideal extent of the background would be to the word Tunbridge, or maybe fitting the background around each individual word could be better?
The Equalizer (talk) 09:16, 1 September 2018 (UTC)
The Equalizer, if you want tight background colouring, you can try using {{bg}} instead. see, for example, this change. Frietjes (talk) 13:19, 1 September 2018 (UTC)
Sweet - we like that. Thanks for the tip. The Equalizer (talk) 13:58, 1 September 2018 (UTC)


Further feature reporting chaps. Browsing the List of settlements in Norfolk by population page, if you hover over the Downham Market and King's Lynn labels, they don't produce a clickable link until you hover over precise sections of the text. Again, only on top and bottom labels, and have noticed the effect for a while now, happens in both Chrome and IE. It seemed to occasionally occur when using the <br /> line break code, and sometimes I could either remove that or label_width the effect out, but I'm not using any html, and label_width hasn't worked here. Of course I could change the orientation of the label but as before, on a tight map, that's not always easy. I've tried a few tweaks on the map:

  • I find the Aylsham element is in line horizontally and seems to interact in some unusual way - when I change the orientation of the Aylsham label, the Kings's Lynn label then works correctly.
  • The same occurs if I change the position of the Attleborough label, Downham Market then works well - again, it's closeby.

I could go larger on the map so there is more room and re-orientate the labels to fix, but I try to keep them smaller for smaller screens etc.
Any tips on making this more predictable will always be appreciated.
--The Equalizer (talk) 16:37, 2 September 2018 (UTC)

USA Virginia Richmond metropolitan area

Powhatan, Virginia is currently showing: Lua error in Module:Location_map at line 502: Unable to find the specified location map definition. Neither "Module:Location map/data/USA Virginia Richmond metropolitan area" nor "Template:Location map USA Virginia Richmond metropolitan area" exists.

That is because Rockhead126 moved Module:Location map/data/USA Virginia Richmond metropolitan area to Module:Location map/data/Richmond metropolitan area. Putting the following in the article would fix its problem:

pushpin_map = Richmond metropolitan area#Virginia#USA

However, "what links here" shows that the red-linked module is also used at Template:Location map/List. I was going to fix that and the article but the list has me bluffed. The red link "USA Virginia Richmond metropolitan area" occurs in a long list of "USA ..." entries and I'm wondering if "Richmond metropolitan area" is the standard name. Perhaps the move should be reversed? Johnuniq (talk) 08:34, 16 October 2018 (UTC)

The module should be moved back. The "USA Virginia..." naming is standard, and it helps differentiate the map from one of the many other places called Richmond (deliberate link to dab page). – Jonesey95 (talk) 10:09, 16 October 2018 (UTC)
agreed, I have moved it back. Frietjes (talk) 11:39, 16 October 2018 (UTC)

"Eswatini" not supported

Currently when I try and change the |pushpin_map= value from "Swaziland" to "Eswatini" I get Lua error in Module:Location_map at line 502: Unable to find the specified location map definition. Neither "Module:Location map/data/Eswatini" nor "Template:Location map Eswatini" exists.. Following on from the article discussions here and here and the category discussion currently ongoing here, two things should happen here. Module:Location map/data/Swaziland should be renamed to Module:Location map/data/Eswatini and "Eswatini" should an accepted value (in addition to keeping "Swaziland" to not break anything). --Gonnym (talk) 19:35, 5 November 2018 (UTC)

Gonnym, should work now. Frietjes (talk) 19:51, 5 November 2018 (UTC)
Thanks! --Gonnym (talk) 20:02, 5 November 2018 (UTC)

Error in hiwiki

Error reads "लुआ त्रुटि Module:Location_map में पंक्ति 390 पर: Minutes can only be provided with DMS degrees for longitude।". Please help Capankajsmilyo(Talk | Infobox assistance) 16:06, 5 November 2018 (UTC)

Capankajsmilyo, how about a link to the page with the error? Frietjes (talk) 16:24, 5 November 2018 (UTC)
Sure, hi:अल्मान्सा का किला Capankajsmilyo(Talk | Infobox assistance) 16:26, 5 November 2018 (UTC)
Capankajsmilyo, fixed. Frietjes (talk) 16:51, 5 November 2018 (UTC)
Thanks a lot Frietjes. Can you please tell what the issue was, for future reference? Capankajsmilyo(Talk | Infobox assistance) 03:47, 6 November 2018 (UTC)

Also a similar problem at sa:अजमेर. Capankajsmilyo(Talk | Infobox assistance) 08:40, 6 November 2018 (UTC)

@Capankajsmilyo: Looking at this changeset, it's to do with the parameters. DMS were being assumed, so Frietjes made that conditional and added in a decimal parameter. I'm now looking at sawiki. Bellezzasolo Discuss 11:14, 6 November 2018 (UTC)
It looks to me like the {{coord}} invocation produces the native words for North/South, but Location map is looking for N or S. Bellezzasolo Discuss 11:52, 6 November 2018 (UTC)

Others positions

"The position of the label relative to the mark. Valid values are left, right, top and bottom. The default is right." Is it possible to use top left, top right, bootom left & botom right position on maps with other parameter? Or is it possible for someone, to make that positions valid? Or it is, and i still don't know? Mazovierka (talk) 15:21, 2 December 2018 (UTC)

Mazovierka, could be possible. I seem to recall one of the non-English versions of this module/template supporting compass directions? now I can't remember which one. in any case, the current method is to use {{raise}} and {{lower}} with one of the existing directions. Frietjes (talk) 16:46, 2 December 2018 (UTC)
Thanks. After that, i also find option with combination of <big><sup>text</sup></big> => text Mazovierka (talk) 09:52, 3 December 2018 (UTC)

Module:Location map/data/Russia North Caucasian Federal District

Can anyone fix this? They are not in the right spot. RainbowSilver2ndBackup (talk) 19:50, 8 January 2019 (UTC)

@RainbowSilver2ndBackup: I think I've sorted it, although the two points are very close together. I had lattitude and longitude the wrong way around. Bellezzasolo Discuss 23:36, 8 January 2019 (UTC)

Cropped maps

I hacked a cropped map for Penang International Airport to show feasibility. this hack is currently using {{CSS crop}} which is based on {{CSS image crop}}, but I imagine we could make this less of a hack by supporting cropping here. basically, you would be able to say something like |crop=cropwidth/cropheight/offsetleft/offsettop to zoom the map into a particular location. comments, problems, suggestions? Frietjes (talk) 15:48, 19 January 2019 (UTC)

All legacy maps have been converted to modules

FYI, all the legacy template-space maps have been converted to modules, so we can now remove that branch of the code. I will wait a week or so before doing so just in case there are objections or problems. Frietjes (talk) 00:14, 8 January 2019 (UTC)

now removed. Frietjes (talk) 23:57, 14 February 2019 (UTC)

Inset maps

It would be nice to have the inset maps shown in de:Liga Orangina 2011/12, enabled using de:Vorlage:Karte in einer Ecke, which appears to have been translated into many other languages (not English yet). Frietjes (talk) 16:28, 5 February 2019 (UTC)

Code is originally from the french wikipedia - fr:Modèle:Carte en coin. (dewiki copied from the Upper Sorbian wiki who copied it from the Esperanto wiki who copied it from frwiki...) Galobtter (pingó mió) 09:19, 9 March 2019 (UTC)

Get coordinates of linked articles from Wikidata

For multi-location maps where the pushpins are linked to articles, it would be nice if the coordinates could be automatically fetched from the Wikidata item for the linked article. This would make it much less tedious to create maps like the one in List of World Heritage Sites in Western Europe, as you wouldn't have to copy-and-paste the coordinates from all the linked articles.

The logic in the p.mark function would be something like: if the coordinate parameters are absent and the link parameter is present, then check if Wikidata has coordinates for the linked article (or, if it's a redirect, for the redirect target article). If not, then fall back to the current behavior of checking if Wikidata has coordinates for the current article.

The first step, I think, would be to add a tracking category to check for any maps that would be affected by this change (i.e. any pushpins that have a link but no specified coordinates). Toohool (talk) 22:59, 21 March 2019 (UTC)

Please copy the sandbox code into the live module (diff). This adds the tracking category Category:Location maps with linked markers with coordinates from Wikidata as I described above to identify any pages that would be affected by the change I proposed. A test case can be seen at the Wikidata sandbox (it can't really be tested on the template testcases page because that page doesn't have coordinates in Wikidata). You can see that the tracking category is added to that page, because the map has a link parameter and no coordinates parameters. If you edit that page to remove the link parameter or add coordinates parameters, then the tracking category goes away. Toohool (talk) 23:15, 28 March 2019 (UTC)
 Done -- /Alex/21 12:18, 29 March 2019 (UTC)

Loc map in switcher?

Sup Luas, Can a location map go inside the switcher template, e.g., switching with an image? Cheers! ——SerialNumber54129 10:32, 12 April 2019 (UTC)

Please limit error checking to main (article) space

Category:Location maps with different longitude and latitude precisions is not limited to main (article) space, but it should be. Can someone who knows about Lua programming please place this limit on this and other tracking categories used by this module? Thanks. – Jonesey95 (talk) 15:30, 28 April 2019 (UTC)

@Jonesey95: I think I fixed it in the sandbox. The tests pass. But I'm a beginner at Wiki-Lua. Maybe someone like Frietjes can review my code changes before we go live? —hike395 (talk) 21:11, 28 April 2019 (UTC)
looks correct to me, so done. Frietjes (talk) 13:21, 30 April 2019 (UTC)

Brazil state map

Can anyone make all the Brazil state map? --Aleenf1 05:29, 11 May 2019 (UTC)

Aleenf1 if you have the svg map images, then I could probably help. if you don't, you should ask at Commons:Graphic Lab/Illustration workshop. Frietjes (talk) 12:15, 11 May 2019 (UTC)

Background isn't aligned with Lower and Raise templates

Following the suggestion at Module talk:Location map#Others positions to use {{lower}} and {{raise}} to get more position options, when one of these is used with |background=, the background is not placed where the label. Any suggestion on how to achieve a a position such as this (bottom-right, top-left, etc)? --Gonnym (talk) 15:01, 13 May 2019 (UTC)

Gonnym, you could use {{bg}} instead of the background parameter. Frietjes (talk) 16:38, 13 May 2019 (UTC)
Thanks Frietjes, that works. --Gonnym (talk) 17:33, 13 May 2019 (UTC)

Bad coords at UK England Southwest?

Please take a look at this sandbox page, in which the same coordinates show at two different locations in England, depending on which location map is used. The "UK England" map looks right, but the pushpin in the UK England Southwest map is in the wrong location, as far as I can see. Does someone here know how to fix it? – Jonesey95 (talk) 08:47, 14 May 2019 (UTC)

I've fixed it. Module:Location map/data/UK England Southwest was incorrectly specifying east instead of west of Greenwich. -- Dr Greg  talk  21:50, 15 May 2019 (UTC)
That is much better, but if you look at my sandbox page linked above, the pushpin is still in a slightly different place in each map. The southwest England map is still a little bit wrong. – Jonesey95 (talk) 04:41, 16 May 2019 (UTC)
Jonesey95, I made some adjustments using the centers of some of the islands to calibrate. should be better, but may be off by a pixel or two (the computed least-squares residual is within 0.0046 degrees for all four points that I used). Frietjes (talk) 21:21, 16 May 2019 (UTC)
That looks great! Thanks. – Jonesey95 (talk) 04:53, 17 May 2019 (UTC)

Not mobile friendly

This template should use the noresize class.

Pages which use it become unreadable due to maps that exceed the width of the page. Jdlrobson (talk) 11:26, 29 November 2019 (UTC)

Query re alternative map

G'day all, I want to use the alternative map for Module:Location map/data/NDH within Template:Infobox military conflict on Operation Rösselsprung (1944), and I can't work out what the syntax is. Any ideas? Thanks, Peacemaker67 (click to talk to me) 03:08, 1 February 2020 (UTC)

Making the underlying image unclickable

For location maps with multiple marks, it would be helpful if only the marks were clickable but the image was not. This would avoid accidental clicks taking the reader to the blank svg map on wikico mons. Is this possible to add as an option? Onceinawhile (talk) 13:12, 8 July 2020 (UTC)

@Onceinawhile: This is already possible; just set the maplink parameter to the empty string. Jackmcbarn (talk) 19:23, 26 July 2020 (UTC)
@Jackmcbarn: fantastic thank you. Onceinawhile (talk) 19:57, 26 July 2020 (UTC)
@Onceinawhile: Note it is my understanding that, for copyright reasons, you should do this only if the map image file is in the public domain, unless you provide some other method of providing the attribution that is required under a Creative Commons licence. -- Dr Greg  talk  21:31, 26 July 2020 (UTC)
@Dr Greg: The "magnify" button in the bottom-right corner will still unconditionally link there, and to my knowledge is considered good enough for attribution. Jackmcbarn (talk) 21:39, 26 July 2020 (UTC)
I'd forgotten that was there. Yes, you are right. -- Dr Greg  talk  01:26, 27 July 2020 (UTC)

Prevent label from wrapping

Is there a way to prevent labels from wrapping/splitting into multiple lines? For example, in this map (see right) the splitting of "Kutai Kartanegara" make it unclear which marker it is labelling. HaEr48 (talk) 00:22, 28 August 2019 (UTC)

Location map/Archive 10 is located in Indonesia
Jakarta
Jakarta
Penajam Paser Utara
Penajam Paser Utara
Kutai Kartanegara
Kutai Kartanegara
Indonesia's current capital (Jakarta) and proposed new capitals
You could use {{nowrap|Kutai Kartanegara}} as the label. This example might also benefit from "position=left" for Penajam Paser Utara. -- Dr Greg  talk  01:35, 28 August 2019 (UTC)
Location map/Archive 10 is located in Indonesia
Jakarta
Jakarta
Penajam Paser Utara
Penajam Paser Utara
Kutai Kartanegara
Kutai Kartanegara
Same map, using nowrap
It works. Thank you! HaEr48 (talk) 13:26, 29 August 2019 (UTC)

I have two requests/suggestions.

This is clearly a very important facility as it is often not possible to make the map clearly legible without it (without changing the scale etc).

1 Please add it to the documentation of the templates that use it, so that users know this facility is available.

2 Even better, add it as an additional parameter of the templates, as this would be a lot easier to use.

Neither of the above would require a lot of work!

Thanks ---Ehrenkater (talk) 11:18, 26 August 2020 (UTC)

@Ehrenkater: I did option 1 in Special:Diff/975117884. I don't see a reason to introduce tight coupling between the templates by doing option 2. Jackmcbarn (talk) 20:36, 26 August 2020 (UTC)


Thanks very much for 1, much appreciated. Re 2, I'm not sure what you mean by tight coupling; what I had in mind was an additional parameter whose use is entirely optional.---Ehrenkater (talk) 09:20, 27 August 2020 (UTC)
@Ehrenkater: My point is that there's basically no benefit to |label=Foo Bar|label_nowrap=1 vs. |label={{nowrap|Foo Bar}} (in fact, your way is longer to type), and there is a cost: now this module would need code related to wrapping, even though the same effect can be achieved without it. Jackmcbarn (talk) 20:55, 27 August 2020 (UTC)

Cropping maps

Would it be possible to add cropping functionality, such as at Template:Annotated image to this template? It would avoid the need to create custom vector maps, thereby opening up many new uses for the template. A good example of the problem it would solve is at wikipedia:Graphics_Lab/Map_workshop#Biblical_Mount_Sinai. I see Frietjes proposed this last year at Module_talk:Location_map/Archive_10#Cropped_maps but it seems nothing came of it. Onceinawhile (talk) 21:02, 12 May 2020 (UTC)

Onceinawhile, I can try to work on this, but for now, see the method described in {{CSS crop}}. once we have a method to crop maps here, we will convert any pages using {{CSS crop}}, but that will be done in semi-automated fashion once there is another solution. another popular method (and probably more scalable method) is to use {{OSM Location map}} which doesn't require creating maps for every place on earth. Frietjes (talk) 23:59, 12 May 2020 (UTC)
This is about the same thing I'm trying to figure out. I think it might be possible to make map cropping not hideously complex (as the CSS crop template requires you to do all sorts of insane calculations about pixels and offsets -- it seems like some clever code might make it so you just pass the data into a template which auto-computes crops/offsets/etc). I guess I'll find out. { } 03:14, 19 September 2020 (UTC)

Is there a way to make it display cropped versions of an image?

I have been looking through the code to see if this is even feasible, but here is a thing that happens sometimes: you want to put a bunch of points on a map, but the map isn't really the right size. So instead, you have the option of making a whole new file and a whole new thing of map data for it... but it seems to me like it might be possible to automate this. Like, say you wanted to put fifteen things from Wayne County, Michigan on a map. You use the location map many template to do this. But all you've got is the map of Michigan. Since that's an SVG, it should be possible to set a display window on it, so that the article just has the part with Wayne County in it. Or maybe not. I don't know. Anyway, if this is a thing someone already did and I've been too lazy to find it, let me know. Else, I'll try and figure something out. { } 02:22, 19 September 2020 (UTC)

@Jacob Gotts: I think you're looking for {{CSS crop}}. Jackmcbarn (talk) 02:53, 19 September 2020 (UTC)
That looks like about the same thing I'm going for. Looking at the documentation, I'm thinking I might make a template where you just pass in a dataset, an original map, and it computes the right values for the {{CSS crop}} transclusion. It'd be neat if there were a way to make templates parse out module data (i.e. automatically retrieve the NSWE extents of the original map) and displayed point data (i.e. automatically figure out the N/S/W/E extent of the points being mapped), rather than having to compute out pixel values by hand for every map... I've got a lot of documentation to read but I think it might be possible. { } 03:12, 19 September 2020 (UTC)
@Jacob Gotts: This module already has a function to get the extents of the original map. For example, {{#invoke:Location map|data|United Kingdom|left}} returns -11. As for getting the extent of the points being mapped, there's not currently a way to do that, but I don't think it would be too hard to add one. The one place where this gets tricky is maps like Module:Location map/data/United States, that use a non-equirectangular projection. Jackmcbarn (talk) 03:47, 19 September 2020 (UTC)

Template-protected edit request on 28 March 2020

Request to add the noinclude tags back on the categories and close the include tag, it was inadvertently removed from these last two edits, Special:Diff/880025074/888921545 and Special:Diff/888921545/891276930. Thanks. Lam-ang (talk) 16:01, 28 March 2020 (UTC)

Somaliland location map

Can someone help me with fixing the Somaliland location map? The coordinates are off and I tried to fix it for a while Al-Burcaawi (talk) 17:50, 30 December 2020 (UTC)

I think the editor is referring to Module:Location map/data/Somaliland. – Jonesey95 (talk) 01:43, 31 December 2020 (UTC)

Adding lines/paths/boxes to map

Is there a way to add a line, path or box on a map? I saw there's a way to add a continuous line along a long or lat but what about one that goes from lat/long to lat/long?Dmm1169 (talk) 18:36, 31 December 2020 (UTC)

Question

What is this used for? –Cupper52Discuss! 10:38, 23 January 2021 (UTC)

Parameters of a new map (Latin America)

Hello all, I study how to make new maps on Wikipedia and I need you help. Could you please let me know how I shall calculate coordinates of Latin America map to use it as coordinates map?--Fokebox (talk) 08:50, 10 February 2021 (UTC)

Title coords not displaying for standalone maps?

Looking at an article which uses a standalone {{location map}}, Cornmarket Street specifies title coords but these aren't shown on the article - they are however, passed to the API correctly.

Is something in this template deliberately concealing the display of title coords (perhaps under the assumption that the map will be in an infobox which also displays title coords)? Should it? Or is the standalone map as in Cornmarket Street an inappropriate use of the location map template? --Lord Belbury (talk) 11:06, 27 February 2021 (UTC)

It uses the coordinates to locate the dot on the map. The examples in the template documentation say to specify the coords with the eight lat/log parameters when not used in an infobox. Jonesey95 moved the coord template outside the map template to make the coords display at the title in this edit. It was not necessary to specify the coords again to the map template as it got them from wikidata, so the using the eight lat/log parameters was not necessary. There is nothing inappropriate in using the location map template this way - you just can't have the coords display at the title the way it was.
I went ahead an added an infobox, so now the map gets the coords locally again. MB 16:43, 27 February 2021 (UTC)

Philippine Sea / West Pacific map

I've been searching for a map to show the strategic location of Guam in the western Pacific, and I'm hoping someone can point to one that I missed. "Pacific Ocean" is OK for the big picture (see my draft), but both "North Pacific" and "Oceania" are not quite right (see older draft). I really want something that shows the relationship of Guam to Japan, Taiwan, and Papua New Guinea without too much fluff. I've tried looking for "Philippine Sea", "West Pacific Ocean", and even "Micronesia" for something a little more focused, but none of those exist. I read Creating a new map definition twice, and have little idea what some of the concepts are, so I doubt I'll be making my own map. Anyone have any ideas of an existing map that might be suitable but is not under a title I've looked for? Thanks! - Featous (talk) 01:28, 16 March 2021 (UTC)

Nunavut map doesn't show all of Nunavut

The map for the Canadian territory Nunavut http://commons.wikimedia.org/wiki/File:Location_map_Nunavut_2.png doesn't show Akimiski Island, which is (legally) part of Nunavut. The article uses the Ontario map, and if you click on the map, it has the caption "Akimiski Island is located in Ontario" which, again, is not true. Akeosnhaoe (talk) 00:50, 26 February 2021 (UTC)

Its on my todo list, but it may be a month or more before I get around to it. It needs a matching relief map too. MapGrid (talk) 02:24, 27 February 2021 (UTC)
I found a set of much better maps of Nunavut already on Commons and updated the template to use File:Canada_Nunavut_location_map-lambert_proj3.svg instead of the current image. Akeosnhaoe (talk) 15:35, 19 April 2021 (UTC)
had to revert this because the x/y formula for the projection that I copied from w:pl:Moduł:Mapa/dane/Nunavut were a bit off, you can see this on w:pl:Akimiski where the push pin is a bit south of the island. Akeosnhaoe (talk) 15:48, 19 April 2021 (UTC)
Akeosnhaoe, I created Module:Location map/data/Canada Nunavut complete using the French WP map. we could make this the default if it is working properly. Frietjes (talk) 21:20, 19 April 2021 (UTC)
I tried that template on Alert, Akimiski and Killiniq Island and the pushpin was in the right place, so I think it's safe to make it the default. Personally, I think the long/lat lines make the image a bit too cluttered, especially since this template creates a thumbnail, which is why I tried using the 3rd image version. But up to you. Akeosnhaoe (talk) 21:42, 19 April 2021 (UTC)

Possibly incorrect positive/negative mixtures

This relates to the report above. I found some examples where the locations appear to have a mixture of positive/negative degrees/minutes. I don't have a good way to find them so I'm not sure if these are errors or not. Please have a look at some of these and see if the location map templates do have a mixture of positive/negative, and try to determine if the mixture is intentional or whether it is an error. Per the above report, I flagged one entry as "error".

Please use the previous section to discuss what should happen with the module. I wanted to focus here on whether there are problems that need to be fixed somehow. Johnuniq (talk) 07:41, 29 April 2021 (UTC)

I have/will fix many of these. this one is not really a mixture, but I since it used the "_deg" syntax, it's better to just use the lat/long parameters. Frietjes (talk) 19:35, 29 April 2021 (UTC)
Thanks, but can you confirm that some/most/all of these are actual errors? I'm thinking that they probably are and that the module should flag the error, presumably with a tracking category at first and possibly a hard error later. Johnuniq (talk) 01:01, 30 April 2021 (UTC)
Umm, I just saw your message at 19:30, 29 April 2021 above which looks good to me. Johnuniq (talk) 01:02, 30 April 2021 (UTC)
I generated a few regexp searches to find negative lat_deg or lon_deg with lat_min/lat_sec/lon_min/lon_sec and fixed most of them. if we throw an error in such cases we should be fine, but I wouldn't throw an error for simply using |lon_deg=-1.234 instead of |long=-1.234, only when mixed with min/sec/dir. Frietjes (talk) 15:07, 3 May 2021 (UTC)

Bug report: The alt syntax calculation is wrong for all negative (i.e, West) longitudes

There's an error in this module's code causing an eastward shift in all western-hemisphere coordinates using the alternate syntax. I first noticed it looking at the maps at Canadian Forces base. I noticed that CFB Comox is marked as being on the mainland, when it should be many kilometres west on Vancouver Island. I did some experiments and found it was reproducible across a variety of coordinates across Canada, so long as I used the alternate syntax and the longitude had a negative degrees component.

The current calculation mishandles negative longitudes by doing a simple addition when converting from DMS-format to decimal. Simple addition works for longitudes with positive degrees (Eastern hemisphere), but for negative longitudes it introduces an error of up to a degree two degrees. The correct way to convert DMS notation to decimal degrees requires ignoring the sign while summing, then reapplying the sign to the final decimal result. (Note that the equation in Decimal_degrees#Example currently contains the same error.)

Since decimal is used for final rendering, this means that coordinates entered using the alternate syntax in the {{location map}} family of templates are all shifted by up to two degrees to the east. This becomes visible in region-scale and dramatic in local-scale maps.

Location map/Archive 10 is located in Vancouver Island
(1) CFB Comox (alt syntax)
(1) CFB Comox (alt syntax)
(2) CFB Comox (decimal)
(2) CFB Comox (decimal)
(3) CFB Comox (decimal error reproduced by hand)
(3) CFB Comox (decimal error reproduced by hand)
Error demonstration

Here is the error demonstrated by hand for CFB Comox on Vancouver Island, British Columbia, Canada:

  1. DMS longitude = -124°53'12"
  2. Decimal longitude, correct calculation = -(124 + 53/60 + 12/3600) ~= -124.886666
  3. Decimal longitude, incorrect calculation = -124 + 53/60 + 12/3600 = -123.113

See the code for this map for each expressed in location map syntax. Only (2) is rendered in the correct location. (1) is miscalculated by this module's DMS-to-decimal conversion, and (3) is the miscalculation reproduced by hand as above and entered using decimal syntax. (1) and (2) should be in the same location, but aren't.

To correct the module, line 92 needs to be changed from:

decimal = decimal + (minutes or 0)/60 + (seconds or 0)/3600

to something like:

decimal = math.sign(decimal) * ( math.abs(decimal) + (minutes or 0)/60 + (seconds or 0)/3600 )

(Note that, if I'm reading the code after line 92 right, this change will cause another kind of error if hemisphere is given at the same time as negative degrees (which is bad user input, but users will be users). Checking for that bad input and handling it may also be worthwhile. Changing the conditional in line 93 to hemisphere and not decimal < 0 (pseudocode) would probably do it.)

I'm not confident making the change myself, and even if I was this area of templates is probably reserved for experts, so instead I hope this bug report is helpful. Thanks! — Saxifrage 00:36, 28 April 2021 (UTC)

Alternatively, if the math module is unavailable, replacing line 92 with a conditional block something like this should do it:
if decimal < 0 then
    decimal = decimal - (minutes or 0)/60 - (seconds or 0)/3600
else
    decimal = decimal + (minutes or 0)/60 + (seconds or 0)/3600
end
That might be more readable anyway. — Saxifrage 01:31, 28 April 2021 (UTC)
I don't believe it is a bug. For western longitudes the degrees, minutes, and seconds should all be entered as negative numbers. e.g.:
| lon1_deg = -124 | lon1_min = -53 | lon1_sec = -12
Some (but not all) of the pogs on my Canada test page (User:MapGrid/location_map_canada_test_page#Default_Map) are using the DMS format; it works just fine. MapGrid (talk) 04:47, 28 April 2021 (UTC)
You should also be able to use positive numbers and specify "lon_dir=W", but I have never bothered to try it. MapGrid (talk) 04:53, 28 April 2021 (UTC)
I see what you mean, but it is very undesirable to accept what is probably broken input. I assume there is never a good reason to enter negative degrees with positive minutes/seconds? The module should complain with an error message. I might be able to estimate how many errors would occur later. Johnuniq (talk) 07:31, 28 April 2021 (UTC)
If it's not a bug, it's a lack of documentation. {{location map}} doesn't have an injunction against using positive minutes and seconds with negative degrees, for example. However, I still think this is a bug. It's not a good idea to require counter-intuitive input even with documentation. It's contrary to the standard for notating DMS coordinates, which never include signs on the minutes and seconds when the degrees are negative. Templates should not require counter-intuitive input, especially when it causes a silent and hard-to-diagnose error in article content. An example in the wild of an article using standard notation in the template and exhibiting silent content errors is Canadian Forces base; among other erorrs, it locates CFB Comox in Squamish, CFB Cold Lake in Saskatchewan, CFB Bagotville in the St. Lawrence river, and CFB Kingston in the United States. — Saxifrage 18:41, 28 April 2021 (UTC)
The existing behavior is not counter-intuitive to me. It is in fact the exact behavior that I expected when I started using the module.
I see it this way:
  • positive degrees: move east of prime meridian
  • positive minutes: move east from current position
  • positive seconds: move east from current position
  • negative degrees: move west of prime meridian
  • negative minutes: move west from current position
  • negative seconds: move west from current position
Also, I do not buy the argument that minutes and seconds should be entered as positive numbers in order to comply with standards for notating DMS coordinates. By allowing degrees to be negative, and also by allowing the lon_dir value to be optional, we have deviated enough from the notation standard that it becomes non-applicable.
Can we agree to disagree and use some code like this?:
if decimal < 0 then
    decimal = decimal - (abs(minutes) or 0)/60 - (abs(seconds) or 0)/3600
else
    decimal = decimal + (abs(minutes) or 0)/60 + (abs(seconds) or 0)/3600
end
MapGrid (talk) 02:47, 29 April 2021 (UTC)
we should do the same thing that {{coord}} does when presented conflicting information, with a similar error message to what you get with {{coord|-9|40||13|20|}}. from the thread below, it appears as though this is not common, so fixing the existing ones and throwing an error message seems like the best thing to do. Frietjes (talk) 19:30, 29 April 2021 (UTC)
Yes, I think that code would be an excellent compromise. Since (e.g.) lon_deg=-55|lon_min=-40|lon_sec=-40 and lon_deg=-55|lon_min=40|lon_sec=40 should both be interpreted as meaning 55°40'40"W, since I doubt anyone would use the latter as a convoluted way of placing a pin at 54°19'20"W (-54.3222°), normalising the min/sec inputs with abs() makes a lot of sense. That way all existing uses of the templates should correctly place the pins where any template user intended when using the alternative syntax, and what seems intuitive entry to each editor will be correctly placed. Thank you for that suggestion, it's very good. It will save fixing existing templates, prevent ongoing errors in new pin placement, prevent misunderstanding of existing entries by different editors, and avoid needing to add error-checking code or error messages. It's an elegant solution. — Saxifrage 17:27, 3 May 2021 (UTC)
Throwing an error like {{coord}} (with tracking) seems like the best approach to avoid confusion. Otherwise, we risk the code incorrectly fixing existing errors. Thanks! Plastikspork ―Œ(talk) 21:41, 3 May 2021 (UTC)
the tracking category, Category:Location maps with negative degrees and minutes or seconds, has been mostly emptied. assuming a massive number of new pages don't show up in there, we can safely change the tracking to an error. Frietjes (talk) 13:53, 6 May 2021 (UTC)
@Frietjes and Johnuniq: This category has been empty for almost 2 weeks now. Should we turn this into an error? Thanks! Plastikspork ―Œ(talk) 22:54, 16 May 2021 (UTC)
Looks good. Johnuniq (talk) 05:18, 17 May 2021 (UTC)

Finding the right map - Dover Eight - in the Chesapeake Bay area

Hello,

Location map/Archive 10 is located in Chesapeake Bay
Bucktown
Bucktown
East New Market
East New Market
Poplar Neck
Poplar Neck
Dover
Dover
Wilmington
Wilmington
Philadelphia
Philadelphia
The Dover Eight's journey began in Maryland and then through Delaware, the riskiest legs were through these slave states. They crossed the Mason–Dixon line into a free state at Philadelphia, Pennsylvania

I used the {{Location map many}} template and the USA Chesapeake Bay image to create this map for the Dover Eight article, but it's kind of skewed: too much of western Maryland and nearly cut off at Wilmington and Philadelphia. Is there a better map or a better way to use the map (cropping out part of western Maryland, etc.)?

Thanks so much!–CaroleHenson (talk) 17:36, 13 June 2021 (UTC)

CaroleHenson, there has been some discussion on cropping, but no robust implementation yet. for now, I have replaced the map in the article with one generated by Template:OSM Location map which automatically generates the map. Frietjes (talk) 20:55, 14 June 2021 (UTC)
Thanks so much, Frietjes, that looks much better! I really appreciate it.CaroleHenson (talk) 23:29, 14 June 2021 (UTC)

Request: Location map for northeastern United States

Would anyone be able to create a map for the Northeastern U.S.? It'd be helpful in a lot of places; I'd particularly like to use it for Seven Sisters. {{u|Sdkb}}talk 06:22, 22 July 2021 (UTC)

@Sdkb: have you tried Module:Location map/data/USA Northeast? you can find cached list of all location maps at Template:Location map/List (I try to periodically update the list). Frietjes (talk) 16:14, 22 July 2021 (UTC)
Oh, thanks! I missed that since the template documentation pointed me to the prefix index and I looked under "United States" rather than "USA". Standardizing the names or improving the documentation to point to the list might help others. {{u|Sdkb}}talk 16:27, 22 July 2021 (UTC)

Radio buttons for multiple-map option are in the wrong place

I don't know if this is new or how long it has been happening, but when a location map is used with multiple map options outside of an infobox, the buttons do not render below the map. See this test case for an example. Can this be fixed? – Jonesey95 (talk) 14:58, 19 August 2021 (UTC)

Jonesey95, probably been this way since multiple-maps were first implemented, see this thread from 2017 for example. another thing you will notice from that example is how the outer image container only wraps the first map. this is fixable, but will require someone to expend the effort to fix it. Frietjes (talk) 21:02, 19 August 2021 (UTC)
It's strange that I have never noticed it before. I guess every multi-map I have seen has been inside an infobox, until I tried to fix the one at Sefine Shipyard today. – Jonesey95 (talk) 21:48, 19 August 2021 (UTC)
this works as well, just need |border=infobox and |float=center. Frietjes (talk) 21:55, 19 August 2021 (UTC)

Spacing between radio button and label

I think there should be some kind of space between the radio button and label, which are almost touching. I added a nbsp to the module sandbox (visible in the template testcases), but it doesn't work with the final "Show all" label, and I can't figure out how that label is being generated. Could someone figure this out? Also: is a nbsp the right option here, or should the space be simple padding? — Goszei (talk) 08:23, 22 August 2021 (UTC)

Goszei, you probably want to have someone modify MediaWiki:Gadget-switcher.js instead, or, add something that targets the switcher-container in Module:Location map/styles.css. people watching MediaWiki talk:Common.css could probably help figure out the best solution. Frietjes (talk) 17:26, 23 August 2021 (UTC)

Radio button label disambig

Articles using File:USA Georgia location map.svg display "Show map of Georgia (U.S. state)". This there a way to suppress "U.S. state"? MB 15:45, 25 October 2021 (UTC)

Frietjes, have you seen this? We don't normally display a disambiguator when the context is already clear. Appling County Courthouse is one of hundreds/thousands of examples MB 17:05, 28 October 2021 (UTC)
User:MB, I updated the map. Frietjes (talk) 17:12, 28 October 2021 (UTC)