Jump to content

Template talk:Infobox mapframe

Page contents not supported in other languages.
Coordinates: 47°30′N 100°30′W / 47.500°N 100.500°W / 47.500; -100.500
From Wikipedia, the free encyclopedia

No access to wikidata?

[edit]

Is it possible to use this template on a MediaWiki install with no access to wikidata? I attempted to do it by specifying coordinates in the coord parameter but I still get Lua error in Module:Infobox_mapframe at line 185: attempt to index field ‘wikibase’ (a nil value). Redheadkelly (talk) 07:29, 17 February 2024 (UTC)[reply]

You may have an extension missing:
https://www.mediawiki.org/wiki/Extension:Wikibase_Client The Equalizer (talk) 12:11, 17 February 2024 (UTC)[reply]
Thanks for your reply. I've been busy with other things. I think this extension is to add Wikibase to my install of Mediawiki, which I do not want to do. I'm using Semantic MediaWiki. But I do copy templates & modules from Wikipedia and many of them contain code that queries Wikibase. Sometimes it's easy to rewrite them so that it's not an issue, but sometimes it's not. If this extension gives me the ability to contact the same Wikibase that Wikipedia is using, that's great. But I do see that it does that. Do I have this right? Redheadkelly (talk) 20:58, 14 May 2024 (UTC)[reply]

How to correct the map of Moscow

[edit]

Hi, can any one correct this map by changing OpenMapStreet data? Map Thanks, Hooman Mallahzadeh (talk) 15:35, 18 March 2024 (UTC)[reply]

Seems the post-2012 boundary is overlain by the old. Give it a few hours. The Equalizer (talk) 17:25, 18 March 2024 (UTC)[reply]

Providing coordinates in the article's infobox appears to hide the geomask

[edit]

It appears that providing coordinates in the article hides the geomask, even though no geomask parameter was provided. See this version of Scottish Parliament Building (coordinates provided using {{Wikidatacoord}}, no geomask showing) compared to this version (coordinates pulled from Wikidata by the infobox, geomask showing). Is there anyone here who can troubleshoot this? Is {{infobox building}} calling {{infobox mapframe}} incorrectly? – Jonesey95 (talk) 21:42, 1 July 2024 (UTC)[reply]

Hi, you have to set | mapframe-wikidata = yes as well when coord is used, as per Template:Infobox building#Mapframe maps. Regs, The Equalizer (talk) 22:58, 1 July 2024 (UTC)[reply]
Brilliant. That fixed it. Thanks. – Jonesey95 (talk) 23:27, 1 July 2024 (UTC)[reply]

Does mapframe-caption work?

[edit]

I tried adding a caption using |mapframe-caption= but nothing shows up. Volcanoguy 17:31, 12 July 2024 (UTC)[reply]

That doesn't work unless the template is integrated into a parent infobox.
For now either put some text directly after the template code (which can look a little untidy) or use {{mapframe}} instead. The Equalizer (talk) 07:36, 14 July 2024 (UTC)[reply]
@The Equalizer: Actually I was using this template in {{infobox mountain}} while trying to use the caption parameter. I tried adding text directly after the template code and it worked, thanks. Volcanoguy 17:31, 14 July 2024 (UTC)[reply]
You are using the embedded parameter in the mountain template to add the mapframe, but it is a bit of a hack to directly add a caption like that. A full integration which creates an automatic map and allows the caption parameter would need the mountain template editing by a template editor - the full way to do this is described here: Module:Infobox mapframe. Regards, The Equalizer (talk) 22:46, 14 July 2024 (UTC)[reply]

New bug for masking in preview and full screen modes

[edit]

Hi, masking does not work for this code map:

{{Infobox mapframe |shape-fill-opacity=.5|wikidata=yes |zoom=4|frame-height=230 | stroke-width=1 |coord={{WikidataCoord|display=i}}|point = none|shape-fill=#ff0000|geomask=Q794|frame-lat=32|frame-long=54|id =Q132945}}

rendered as:

Map

Iran's map must have been white, but is not in preview mode and after clicking full screen mode. Hooman Mallahzadeh (talk) 15:34, 14 July 2024 (UTC)[reply]

Looks fine to me. If I change the mask to Afghanistan (Q889), the white area shows there correctly at preview:

{{Infobox mapframe |shape-fill-opacity=.5|wikidata=yes |zoom=4|frame-height=230 | stroke-width=1 |coord={{WikidataCoord|display=i}}|point = none|shape-fill=#ff0000|geomask=Q889|frame-lat=32|frame-long=54}}

Map

Regards, The Equalizer (talk) 17:11, 14 July 2024 (UTC)[reply]

@The Equalizer It was a temporary bug, and it is now fixed. Thanks. Hooman Mallahzadeh (talk) 04:39, 15 July 2024 (UTC)[reply]

Template:Infobox mapframe/doc/templatedata

[edit]

Can someone familiar with this template, take a look at Template:Infobox mapframe/doc/templatedata and Template:Infobox mapframe/doc#TemplateData and see if anything from the /templatedata sub-page is still up to date (and if so, copy it to the /doc page)? Gonnym (talk) 11:30, 26 July 2024 (UTC)[reply]

implementation issue with infobox mountain

[edit]

Please see Template talk:Infobox mountain#mapframe implementation. --Joy (talk) 04:14, 1 October 2024 (UTC)[reply]

 Fixed. – Jonesey95 (talk) 18:44, 1 October 2024 (UTC)[reply]
@Jonesey95 thanks!
For anyone else reading, there's a followup there still about how to format the default zoom, and some Lua error. --Joy (talk) 08:30, 2 October 2024 (UTC)[reply]

Use Infobox dim to compute zoom?

[edit]

In the sandbox, I changed Module:Infobox mapframe/sandbox at line 216 so that it calls _zoom from Module:Infobox dim to compute the zoom level from an object size. By default, they produce almost the same results (difference in pre-rounded zoom level of about .07, due to slightly different assumptions). The benefit of using Infobox dim._zoom is that it uses the size of the mapframe to compute the zoom. Infobox dim._zoom selects the zoom level so that the object lies fully within the map. If the frame is larger (in pixels), then a higher zoom level is selected.

Any comments or questions about this? — hike395 (talk) 17:54, 7 October 2024 (UTC)[reply]

 Implemented —- now in main. Please let me know if you see any problems. — hike395 (talk) 18:31, 16 October 2024 (UTC)[reply]

zoom levels for rivers

[edit]

Often times the passing of dimensions into the template is beneficial, but I've seen some cases where it's actually worse than the default, like Colbert River, which is zoomed in too much based on dimensions. --Joy (talk) 15:08, 12 November 2024 (UTC)[reply]

Not scientific, but measuring the length of the river as the crow flies using two freely map sources gives a length of at least 15km between source and mouth not even taking into account the meanders, so why 12.6 is stated I don't know, it needs challenging and a citation. Adding that adjusted length into the infobox sets the map to an expected zoom showing the full length of the course. Regs, The Equalizer (talk) 23:26, 12 November 2024 (UTC)[reply]
Makes sense, added a cleanup tag. --Joy (talk) 11:29, 13 November 2024 (UTC)[reply]

I had another odd case, Guaviare River was zoomed out by default so you could see half the continent. Is it because of all the meandering? --Joy (talk) 19:12, 29 November 2024 (UTC)[reply]

Similar for Guayamouc River. --Joy (talk) 19:17, 29 November 2024 (UTC)[reply]
Not quite. The river template takes the length of the object and feeds that to the length parameter for the map. It doesn't take the river length parameter though, only length_mi or length_km. If it can't determine the length because it contains words, convert template included, length used etc, then it defaults to zoom level 10. You can then either use the zoom parameter of course, or use | mapframe-length_km = or | mapframe-length_mi = . Regs, The Equalizer (talk) 16:26, 30 November 2024 (UTC)[reply]
Nono, I'm saying this is *after* I converted it to split the dimensions to be parsable. --Joy (talk) 16:34, 2 December 2024 (UTC)[reply]
Yes it will be as well, since the many meanders give a misleading sense of straight-line distance, which maps scales out for. Regs, The Equalizer (talk) 23:23, 2 December 2024 (UTC)[reply]
Yes, that's what I suspected as well.
Can we introduce a mitigation, for example an extra parameter that indicates the amount of meandering? @Hike395? --Joy (talk) 07:51, 3 December 2024 (UTC)[reply]
@Joy instead of recoding, couldn't we just add a note to length* parameters of the infobox river template that the mapframe-length* parameters should ideally be additionally populated with the straight line length so that the maps display properly (or use the zoom parameter). Regs, The Equalizer (talk) 11:51, 3 December 2024 (UTC)[reply]
I don't know if straight line length is a parameter typically found in sources for rivers, I never saw it myself. At the same time, now that I think about it, what happens if a river is also generally U-shaped or L-shaped, which happens reasonably often - do we still call this "straight line length", or is it actually just some sort of an approximation... maybe in those cases it would make sense to tune the basin size, at the same time I don't know the logic, does length_km2 take precedence over basin_size_km2 when deciding on zoom? --Joy (talk) 13:56, 3 December 2024 (UTC)[reply]

showing two extra relations in addition to the wikidata-attached main one

[edit]

At Talk:Indus River#map frame map, @Fowler&fowler has noticed that the OSM relation for that river does not choose either of the two main headstreams, and therefore our mapframe map shows neither. Is there a syntax to add two more relations to an infobox mapframe map?

Would we be able to e.g. supply a list of two more wikidata Q* items as geomask, or something like that? The geomask example shows a shape that that envelops another shape and there's a shading, which wouldn't seem appropriate in the case of lines, so I'm not sure what to do. --Joy (talk) 23:25, 27 November 2024 (UTC)[reply]

Replied over there explaining the options available. Regs, The Equalizer (talk) 01:23, 29 November 2024 (UTC)[reply]
Thanks. I wasn't aware of this, and I went to check the documentation, but couldn't find anything about it. The template doc still says: This template only works with single features (points, lines, or shapes); use {{maplink}} if more advanced options, such as displaying multiple features, are required. - so that seems quite misleading...
Yet the argNumber handling in the module seems to have existed since 2019...? --Joy (talk) 15:45, 29 November 2024 (UTC)[reply]
Hmm, wait, no, the example was for {{mapframe}}, whereas {{infobox mapframe}} does indeed not work with extra parameters. --Joy (talk) 16:39, 2 December 2024 (UTC)[reply]

Let the module find usable values for zoom and frame-coord when using geomask

[edit]

Geomask is pretty useless now if you don't explicitly specify zoom and frame-coordinates due to phab:T305121. For example gives

{{Infobox mapframe|id=Q2087297|geomask=Q1207|stroke-width=2}} (Knife River in North Dakota):

Map

It can be fixed by

{{Infobox mapframe|id=Q2087297|geomask=Q1207|stroke-width=2|frame-coord={{WikidataCoord|Q1207}}|zoom=5}}:

Map

But couldn't the module itself find usable values for zoom and frame-coordinates if none are specified when using geomask? Dipsacus fullonum (talk) 16:17, 4 February 2025 (UTC)[reply]

 You are invited to join the discussion at Wikipedia:Village pump (technical) § OpenStreetMap Issue in Wikipedia Article. --Ahecht (TALK
PAGE
)
16:47, 28 February 2025 (UTC)[reply]

How do I set the mapframe width to the reader's thumb size preference?

[edit]

From the documentation, it appears that the |width= of the mapframe image is specified in pixels, but per MOS:IMGSIZE, Except with very good reason, a fixed width in pixels (e.g. 17px) should not be specified, because it ignores the user's base width setting. Thus upright=scaling factor is preferred when it is desired to present an image at other than the default width. How do I set the mapframe size to match the reader's thumb size preference, as recommended by MOS? – Jonesey95 (talk) 04:40, 12 March 2025 (UTC)[reply]

See WP:IMGSIZELEAD. Regs, The Equalizer (talk) 21:25, 12 March 2025 (UTC)[reply]
Thanks for the link, but that did not help me. Also, the mapframe map is not the lead image in any infobox that I know of. Maybe I'm dense. Can you please link to an example of a page with the mapframe map specified to display at thumb size or a multiple thereof? – Jonesey95 (talk) 23:40, 12 March 2025 (UTC)[reply]
Just set it to 220px and then 250px once T355914 is done - it is currently underway and will change the default thumb size. There are two reasons why looking up that thumb size is not worth it. One is that people do actually not change it from the default. To quote DBA/SRE members of the WMF "In other words, 98.9% of users are using the default and the second most popular one is 0.33%." The other reason is that default thumb sizes, apart for the change allready mentioned, has not changed for over a decade. And no, there is not a lua function to look up this thumb size for the current user. Snævar (talk) 02:04, 15 March 2025 (UTC)[reply]

The context of MOS:IMGSIZE is clearly about stand-alone images, not ones in infoboxes. To have uniformly formatted infoboxes should be the standard. -- P 1 9 9   18:04, 14 March 2025 (UTC)[reply]

I agree that a uniform image width should be the standard, which is why WP:IMGSIZELEAD mentions the upright parameter instead of explaining how to use pixel sizing. I am asking how to set a mapframe map to match the reader's standard thumb size preference. MOS:IMGSIZE refers to the size of a "lead image". MOS:LEADIMAGE, on the same page, explains the lead image like this: It is common for an article's lead or infobox to carry a representative image. Module:InfoboxImage, which is commonly used to display lead images in infoboxes, has frameless and upright options, which allow lead images in infoboxes to comply with both MOS:IMGSIZE and with readers' preferences. So how do we follow this standard for mapframe maps in infoboxes so that they match the infobox's lead image size? – Jonesey95 (talk) 19:27, 14 March 2025 (UTC)[reply]
Apologies that link I gave was just for images. It doesn't look like you can for the map frame. There is no upright parameter in Module:Mapframe & Module:Infobox mapframe, the width and height settings are fixed default numbers, which are the size of the displayed frame only and of course has no effect on the map scale (zoom parameter does that), while images use px size as of course you can't adjust width/height independently. The Equalizer (talk) 21:41, 14 March 2025 (UTC)[reply]
A number of templates could benefit from having a WP:VARiable and a Lua/Scribunto function to look up the default thumb size, including mapframes, location maps, and {{Multiple image}}. They'll say 98.9% of users are using the default, but how many of those are actually active, not to say contributing? I'd check if m:Community Wishlist/Wishes can do anything about this. Ponor (talk) 05:46, 15 March 2025 (UTC)[reply]

Map 100 miles off target

[edit]

Can anyone help at template talk:infobox building#Can anyone tell why the map in this article is wildly off?, please? 𝕁𝕄𝔽 (talk) 00:00, 14 March 2025 (UTC)[reply]

I've replied to the thread. Regs, The Equalizer (talk) 02:16, 15 March 2025 (UTC)[reply]

military installation testcase failure

[edit]

Can someone help explain why no mapframe is rendering at Template:Infobox military installation/testcases#Rmanj Fortress (mapframe), despite me specifying all the various parameters that are usually working?

The analogous embedded use at the original article Rmanj Fortress does work... --Joy (talk) 21:01, 19 March 2025 (UTC)[reply]

The usages are not the same. The article uses {{Infobox mapframe}} inside of the |image_map= parameter. The test case uses mapframe parameters directly. If you edit that test case, you should see red error messages explaining that many of the parameters used there are not supported. That's why those parameters are not doing anything. – Jonesey95 (talk) 15:47, 20 March 2025 (UTC)[reply]
I added the support for it in the sandbox. [1] That's why I'm testing it. --Joy (talk) 18:48, 20 March 2025 (UTC)[reply]
Because mapframe was not incorporated into the military infobox template - see the table at Wikipedia:Mapframe maps in infoboxes. Some of the test cases have mapframe maps because they are subtemplating the infobox airport template which does pull in a map. However, it works on the article because mapframe is used as a subtemplate within the infobox. The Equalizer (talk) 15:48, 20 March 2025 (UTC)[reply]
See above. Sorry if the last sentence above was too much of a distraction. --Joy (talk) 18:49, 20 March 2025 (UTC)[reply]
Ok - fixed by using alt parameters in the sandbox. All the test cases are working well. Bear in mind that the mapframe map appears with some cases showing 'pushpin' maps - that's because those aren't actually using the parameter to display it. Your Rmanj Fortress example has a pushpin but forces the mapframe so that too is fine. The cases with airplane infoboxes should also be fine to leave. Sandbox2 will need updating though. Also, one case is showing an lua error but that is by design because it's deliberately using blank parameters. Regs, The Equalizer (talk) 01:28, 21 March 2025 (UTC)[reply]
Thanks. Why would image4 work, but not image5? I previously had a problem where I had too big of a jump between the numbers, but this is directly after and still unsupported. This seems counter-intuitive, arbitrary.
The other cases not showing are fine, that is always what I do, this way is more conservative (if there's already a map, don't touch anything).
No idea about Template:Infobox military installation/sandbox2, it has no documentation, so that looks like it's up to whoever uses that. --Joy (talk) 11:44, 21 March 2025 (UTC)[reply]