Template:Population density WD/doc

Calculcates and shows the population density of a place, based on area and populaction numbers retrieved from Wikidata.

Usage
, without arguments, will show the population density of the current article subject, default in inhabitants per km2.

, will show the population density of the Wikipedia article page title stated in the first unnamed parameter. The template does not use the Wikidata label. It also works if the article is moved, since it follows the redirect.

The second unnamed parameter states the unit:, for example PD/km2 (default), PD/sqmi, PD/acre, PD/scyd or PD/sqfoot.

The template is mainly intended for tables showing the population density of several geographical regions. A clickable pen is shown next to the value to users that have logged in are auto-confirmed. The pen is helpful in finding out at which Wikidata page each value in the table can be edited, and where the citations and edit history of each data value can be found. The pen is hidden to other users to reduce the risk of vandalism.

A purpose of this template is to avoid advanced code in Wikipedia articles, by using a comprehensible property name and article title instead of pid and qid codes. However, the template may also be called with a parameter named qid.

Current article
Example: shows the population per km2 of the current article subject.

Articles sharing the same Wikidata label
The template does not use the Wikidata label. These two places have the same label São Paulo: gives the population density of São Paulo: /km2.

gives the population density of São Paulo (state):.

Redirect
The redirect page Sao Paulo, Brazil does not have Wikidata item of its own. Then the template shows data for the redirect destination São Paulo: gives:.

Qid code
Another option is to use the qid code of. This however makes the wikicode less comprehensible, but is useful if the place has a wikidata item but no Wikipedia article: which gives:.

Other units
Population density units that are accepted by can be used in the second unnamed parameter, for example which gives: acres. gives:  per square mile. gives: per square yard. gives: per km2 (default unit).