Template:Infobox settlement/checkauto/doc

This subtemplate of Infobox settlement checks the inputs that will be passed to Infobox settlement/densdisp if there is a density to be displayed. This template outputs the density either as provided or as calculated (if set to auto). The automatic calculation requires both the population and area; if either is not provided then this template generates no output.

Examples with density auto
As shown in the following examples, this template calculates the density if all three of the following conditions are met: /km2 (or /sqmi) is set to auto, a number if given for population, and a number is given for area. It also strips any formatting from the numbers, such as population with commas in the examples, which would otherwise cause an error in the calculation (see mw:Help:Magic words).

Examples with density number
As shown in the following examples, this template always displays the density if given as a number, regardless of whether the population and area are defined. It also strips any formatting in the number, such as the commas in the examples.