Template talk:Infobox settlement/densdisp
Expression error
editWaht causes the expression error in the example at the bottom in this version? Anrie (talk) 08:50, 30 November 2007 (UTC)
- Sorry, I'd forgotten to udpate the example when the order of the parameters was changed. Think it's fixed now.--Kotniski (talk) 09:08, 30 November 2007 (UTC)
- Thank you. Anrie (talk) 09:40, 30 November 2007 (UTC)
Automatic calc of population density
editI don't really know whether to raise this here, or at one of the following: Template talk:Infobox settlement/permi2km2; Template talk:Infobox settlement; Template talk:Infobox French canton.
Basically, the problem is that when {{Infobox French canton}}
is given (say) |pop=1000
but all of |km²=
, |area=
and |dens=
are empty, error messages are shown in the infobox and the article ends up in Category:ParserFunction errors. To see some examples, visit that category and pick almost any of the "Canton of ..." articles, such as Canton of Albertville-Nord, and examine the "Population" section of the infobox. If you edit the page, and fill in a positive, non-zero value for |area=
, the error message disappears. Unfortunately I do not have all the correct figures to fill in, so would prefer a template amendment.
Referring to the documentation of this template:
{{infobox settlement/densdisp|unit_pref|DENSsqmi|DENSkm2|POP|AREAsqmi|AREAkm2|subdivision_name}}
What I would like is that if either DENSsqmi
or DENSkm2
has the value auto
, and both AREAsqmi
and AREAkm2
are blank, the density calculation should not be performed. --Redrose64 (talk) 15:40, 26 January 2010 (UTC)
- I agree. I had been meaning to make the change for sometime. It's somewhat annoying to see an error there just because the area or pop is missing. Plastikspork ―Œ(talk) 16:17, 26 January 2010 (UTC)
- I see that you have added
{{Infobox settlement/checkauto}}
as a pretest to one of the calls to{{Infobox settlement/densdisp}}
- but there are four other calls within{{Infobox settlement}}
, each of which could potentially exhibit similar problems. That said, the French canton articles are now dropping out of Category:ParserFunction errors (which is taking an absolute age to rebuild), so the problem that I described above is sorted. --Redrose64 (talk) 22:36, 3 February 2010 (UTC)- Great, I am glad to hear that I didn't break anything. I am proceeding slowly due to the complexity of these subtemplates. Basically, it appears I need to add a similar pretest to each call of densdisp? I also added some code to densdisp itself to remove the "auto" keyword in the case that the area and/or pop was missing. It appears to at least not introduce any new breakage. Plastikspork ―Œ(talk) 22:49, 3 February 2010 (UTC)
- I see that you have added
Edit request on 19 July 2013
editThis edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Please update to use this version of the sandbox. this will fix a long-standing bug described in this thread. if you check the code for {{rnd}}, it looks for bad values for the precision, then sends them to Category:Pages with bad rounding precision. it then ignores the value specified here, and uses (1 - order of magnitude) instead. this patch corrects the bug by simply sending the value of (1 - order of magnitude) to the {{rnd}}
template. hence, the ultimate output will be unchanged, but it will remove the tens of thousands of articles appearing in Category:Pages with bad rounding precision.
Frietjes (talk) 21:09, 19 July 2013 (UTC)
- Done! Thanks for fixing the bug! Plastikspork ―Œ(talk) 00:11, 20 July 2013 (UTC)
- another small tweak, it appears as though this still adds articles to Category:Pages with bad rounding precision if the population is zero. it looks like this due to whitespace sensitivity of {{order of magnitude}} when checking if the input is zero. In the sandbox version, I removed some space and it fixes the problem. Frietjes (talk) 15:55, 27 July 2013 (UTC)
- Done! Plastikspork ―Œ(talk) 23:50, 27 July 2013 (UTC)
- thank you, the category has dropped from over 50,000 pages to under 200 pages, so it appears this has worked! Frietjes (talk) 16:08, 28 July 2013 (UTC)
- Done! Plastikspork ―Œ(talk) 23:50, 27 July 2013 (UTC)
- another small tweak, it appears as though this still adds articles to Category:Pages with bad rounding precision if the population is zero. it looks like this due to whitespace sensitivity of {{order of magnitude}} when checking if the input is zero. In the sandbox version, I removed some space and it fixes the problem. Frietjes (talk) 15:55, 27 July 2013 (UTC)
Auto
editDid "auto" for the settlement infobox at Urban agglomeration of Montreal, and it doesn't work. I've noticed this with other pages, too. What could be causing it not to work? Criticalthinker (talk) 10:03, 27 February 2023 (UTC)