Jump to content

Template talk:Infobox settlement

Page contents not supported in other languages.
Coordinates: 29°36′36″N 52°32′33″E / 29.61000°N 52.54250°E / 29.61000; 52.54250
From Wikipedia, the free encyclopedia

Conversion error

[edit]

I've encountered a strange error in the area fields and I can't think what's causing it.

In KM2, area total can be larger than area land. But once converted into sq mi, area land becomes larger than area total. You can see this in action at Borough of Halton.

I can only think it must be something hard coded in the conversion, perhaps a rounding error? It doesn't occur when using Template:Convert. Perhaps someone more knowledgeable than me will know what might be behind it please. Dgp4004 (talk) 16:40, 14 June 2024 (UTC)[reply]

Having experimented a little, it seems to be a problem very specific to the figure of 90km2.
  • 89km2 converts correctly to 34 sq mi.
  • 91km2 converts correctly to 35 sq mi.
  • But 90km2 concerts incorrectly to 30 sq mi.
Very bizarre. Dgp4004 (talk) 16:51, 14 June 2024 (UTC)[reply]
Likewise, I have noticed that the template is inaccurately converting 5,181 km2 to 2,000 sq mi on the Powys page. It should be 2,003 sq mi.
Would it not make sense to use template:convert in the infobox rather than the formulas used presently which don't seem to work?
Dgp4004 (talk) 08:53, 16 June 2024 (UTC)[reply]
Probably; this template is old and likely had much of its features written/created before {{convert}} was as good or widely-used as it is now. Primefac (talk) 15:40, 16 June 2024 (UTC)[reply]

A few comments here:

  • 5181 km2 should convert to 2000.3 mi2, not 2003. The template is behaving correctly in this case.
  • The value 90 km2 is ambiguous: it's unclear whether it has one or two significant figures. The template assumes it has one significant figure, hence does the conversion like {{convert|90|km2|mi2|abbr=on|sigfig=1}} → 90 km2 (30 sq mi). There's currently no way to specify significant figures to the template.
  • {{convert}} has a more clever way of determining rounding, so it does the conversion more like you expect: {{convert|9000|km2|mi2|abbr=on}} → 9,000 km2 (3,500 sq mi). You may not consider this correct, however, since it only preserves 2 significant figures.
  • Probably the right thing to do is to substitute {{convinfobox}} for {{Infobox settlement/areadisp}}. I'll experiment with this in the sandbox.

hike395 (talk) 02:40, 18 June 2024 (UTC)[reply]

Sadly, {{convinfobox}} only accepts up to 3 units, while {{Infobox settlement/areadisp}} can handle 5. {{Infobox settlement/areadisp}} also correctly sets the order of the displayed units according to country, while {{convinfobox}} always puts the specified unit first.
This can all be fixed if we port convinfobox over to Lua, which will take some amount of work. — hike395 (talk) 02:48, 18 June 2024 (UTC)[reply]
Thank you so much for looking into it—I wouldn't know where to start! Dgp4004 (talk) 07:27, 18 June 2024 (UTC)[reply]

Edit request 17 June 2024

[edit]

Description of suggested change:

Please replace the manual conversion formulas in this template with Template:Convert as unfortunately the existing set up is producing errors (please see Template talk:Infobox settlement#Conversion error above). Probably not a quick edit I'm afraid, sorry to make big work.

Dgp4004 (talk) 17:19, 17 June 2024 (UTC)[reply]

I think the area formulas are actually held in this sub-template: Template:Infobox settlement/areadisp. Would this request be better submitted there or is this sufficient please?
Dgp4004 (talk) 17:25, 17 June 2024 (UTC)[reply]
 Not done: please make your requested changes to the template's sandbox first; see WP:TESTCASES. – Jonesey95 (talk) 23:16, 17 June 2024 (UTC)[reply]
I would if I understood it. But it's fiendishly complex sadly. Dgp4004 (talk) 23:20, 17 June 2024 (UTC)[reply]

Location labels unreadable in dark mode

[edit]

In dark mode, location labels on map are black text on a black background. This does not happen for me when I use {{location map}} directly, but it does happen in the examples on the {{Infobox settlement}} documentation. I'm not sure where this CSS lives, but it appears that this happens because the color is coming from this block:

@media (prefers-color-scheme: dark) {
  html.skin-theme-clientpref-os .mw-parser-output .od, html.skin-theme-clientpref-os .mw-parser-output .od .pv > div, html.skin-theme-clientpref-os .mw-parser-output .od .pl > div, html.skin-theme-clientpref-os .mw-parser-output .od .pr > div {
    background: white !important;
    color: #000 !important;
  }
}

but the background color is coming from this block:

@media screen and (prefers-color-scheme: dark) {
  html.skin-theme-clientpref-os .mw-parser-output .infobox-full-data:not(.notheme) div:not(.notheme) {
    background: #1f1f23 !important;
    color: #f8f9fa;
  }
}

The second block has higher priority, so the !important background-color there takes effect. I think the color in the second block is missing its !important; that is why it is not overriding the !important color from the first block. Though I'm not sure why the first block is trying to use black text on white background in dark mode. -- Beland (talk) 21:05, 2 August 2024 (UTC)[reply]

This seems to have been fixed, though nothing was changed at Template:Infobox settlement/styles.css or Template:Infobox settlement. Perhaps it was a problem in skin CSS? -- Beland (talk) 17:21, 12 September 2024 (UTC)[reply]

Template-protected edit request on 9 August 2024

[edit]

Add a parameter for flag_type, so that other options like banners can also be added (eg. State banners, municipal banners, county banners etc). Since the infobox Indian state or territory is a customised wrapper for this infobox, and it is explicitly mentioned that Indian states use banners and not flags (since they are only used for the official purpose by the government and not as the representation for the state), I did not want to add the parameter of flag to them, but rather of banner. Pur 0 0 (talk) 15:02, 9 August 2024 (UTC)[reply]

 Not done: please make your requested changes to the template's sandbox first; see WP:TESTCASES. – Jonesey95 (talk) 21:07, 10 August 2024 (UTC)[reply]

Mandatory hidden OpenStreetMap

[edit]

Hi, an OSM map is required for all settlements, but nearly all the times it makes its Infobox ugly. I propose to place an OSM map for all instances of this template and then hiding that by using {{hidden begin}} and {{hidden end}} templates. But if needed, the editors can expand OSM by default by a parameter. Something like this:

Shiraz
Persian: شیراز
Shiraz
Shiraz skyline
skyline of Shiraz;
Flag of Shiraz
Nickname: 
City of Gardens
OpenStreetMap
Map
Shiraz is located in Iran
Shiraz
Shiraz
Location of Shiraz within Iran
Coordinates: 29°36′36″N 52°32′33″E / 29.61000°N 52.54250°E / 29.61000; 52.54250

Hooman Mallahzadeh (talk) 12:39, 5 September 2024 (UTC)[reply]

Sorry, why would it be required? It's optional per Wikipedia:Requests for comment/Mapframe maps in infoboxes
At the same time, what's the ugly part exactly? --Joy (talk) 22:40, 7 September 2024 (UTC)[reply]
Which reminds me, we never added the standard optional mapframe support here. I'll go check in the sandbox if I can do that now, IIRC the local code here was somewhat more convoluted than average. --Joy (talk) 19:02, 8 September 2024 (UTC)[reply]
I also do not see anything required about the mapframe map. I picked a few articles from a dab page and do not see one at Newton, Edmonton, or Newton, Surrey, or Newtown Cunningham, or Newton, Massachusetts. – Jonesey95 (talk) 11:46, 9 September 2024 (UTC)[reply]

mapframe support

[edit]

Phew, [1] was annoying to do, but didn't actually seem particularly complex.

I noticed we actually have a test case already at Template:Infobox settlement/testcases2#Case 17: Chicago with mapframe

Any objections to making this go live? --Joy (talk) 19:38, 8 September 2024 (UTC)[reply]