Jump to content

टेम्पलेट:Infobox settlement/densdisp

Permanently protected टेम्पलेट
विकिपीडिया से

This subtemplate of {{Infobox settlement}} displays a metric/imperial pair of population density values for a line in the main infobox.

Usage

{{Infobox settlement/densdisp
| /km2  = auto or population density per km2 (via population_density_km2 and others)
| /sqmi = auto or population density per sqmi (via population_density_sq_mi and others)
| pop   = population (via population_total and others)
| km2   = area in square kilometres (via area_total_km2 and others)
| sqmi  = area in square miles (via area_total_sq_mi and others)
| ha    = area in hectares (via area_total_ha and others)
| acre  = area in acres (via area_total_acre and others)
| dunam = area in dunams (via area_total_dunam and others)
| pref  = preference to display /km2 or /sqmi (via unit_pref)
| name  = name of country (via subdivision_name)
}}

Examples of density as 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#Formatting).

Code Result Number
(not rounded)
Order of
magnitude
{{Infobox settlement/densdisp|/km2=auto|pop=10|km2=0.00023456}} 43,000/किमी2 (110,000/बर्ग मील) 42633.015006821 4
{{Infobox settlement/densdisp|/km2=auto|pop=10|km2=0.0023456}} 4,300/किमी2 (11,000/बर्ग मील) 4263.3015006821 3
{{Infobox settlement/densdisp|/km2=auto|pop=10|km2=0.023456}} 430/किमी2 (1,100/बर्ग मील) 426.33015006821 2
{{Infobox settlement/densdisp|/km2=auto|pop=10|km2=0.23456}} 43/किमी2 (110/बर्ग मील) 42.633015006821 1
{{Infobox settlement/densdisp|/km2=auto|pop=10|km2=2.3456}} 4.3/किमी2 (11/बर्ग मील) 4.2633015006821 0
{{Infobox settlement/densdisp|/km2=auto|pop=10|km2=23.456}} 0.43/किमी2 (1.1/बर्ग मील) 0.42633015006821 -1
{{Infobox settlement/densdisp|/km2=auto|pop=10|km2=234.56}} 0.043/किमी2 (0.11/बर्ग मील) 0.042633015006821 -2
{{Infobox settlement/densdisp|/km2=auto|pop=10|km2=2345.6}} 0.0043/किमी2 (0.011/बर्ग मील) 0.0042633015006821 -3
{{Infobox settlement/densdisp|/km2=auto|pop=10|km2=23456}} 0.00043/किमी2 (0.0011/बर्ग मील) 0.00042633015006821 -4
{{Infobox settlement/densdisp|/km2=auto|pop=0|km2=23456}} 0.0/किमी2 (0.0/बर्ग मील) 0 0
Code Result Number
(not rounded)
{{Infobox settlement/densdisp|pref=Imperial|/sqmi=auto|pop=123,456|sqmi=10}} 12,000/बर्ग मील (4,800/किमी2) 12345.6
{{Infobox settlement/densdisp|pref=Imperial|/sqmi=auto|pop=12345|sqmi=10}} 1,200/बर्ग मील (480/किमी2) 1234.5
{{Infobox settlement/densdisp|pref=Imperial|/sqmi=auto|pop=1234|sqmi=10}} 120/बर्ग मील (48/किमी2) 123.4
{{Infobox settlement/densdisp|pref=Imperial|/sqmi=auto|pop=123|sqmi=10}} 12/बर्ग मील (4.7/किमी2) 12.3
{{Infobox settlement/densdisp|pref=Imperial|/sqmi=auto|pop=12|sqmi=10}} 1.2/बर्ग मील (0.46/किमी2) 1.2
{{Infobox settlement/densdisp|pref=Imperial|/sqmi=auto|pop=0|sqmi=10}} 0.0/बर्ग मील (0.0/किमी2) 0

Examples of missing population or area

As shown in the following examples, this template outputs nothing if density = auto, but either population or area is missing.

Code Result
{{Infobox settlement/densdisp|/km2=auto|pop=123,456|km2= }}
{{Infobox settlement/densdisp|/km2=auto|pop= |km2=10}}
{{Infobox settlement/densdisp|/km2=auto|pop= |km2= }}
{{Infobox settlement/densdisp|/km2= |pop= |km2= }}

Examples of density as 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.

Code Result
{{Infobox settlement/densdisp|/km2=12,345.67}} 12,345.67/किमी2 (31,975.1/बर्ग मील)
{{Infobox settlement/densdisp|/sqmi=12,345.67}} 4,766.69/किमी2 (12,345.67/बर्ग मील)
{{Infobox settlement/densdisp|pref=Imperial|/sqmi=12,345.67}} 12,345.67/बर्ग मील (4,766.69/किमी2)
{{Infobox settlement/densdisp|/km2=0}} 0/किमी2 (0/बर्ग मील)
{{Infobox settlement/densdisp|pref=Imperial|/sqmi=0}} 0/बर्ग मील (0/किमी2)

See also
https://bh.wikipedia.org/wiki/%E0%A4%9F%E0%A5%87%E0%A4%AE%E0%A5%8D%E0%A4%AA%E0%A4%B2%E0%A5%87%E0%A4%9F:Infobox_settlement/densdisp
bh.wikipedia.org
CC-MAIN-2024-38
116636
application/http; msgtype=response
sha1:IU632X3CAHQHKNJS6VPQKMFY4RVEKOYS
<urn:uuid:c0b1e879-91b9-412c-9e88-fa0ca5668af3>
2024-09-20T02:42:39Z
208.80.154.224
text/html
sha1:BDQ2ILS25VTE4QPFXFBPKWCLJFZIFI6Q
<urn:uuid:e106e640-ea99-42dd-8cad-3ea840a83fb2>
https://bh.wikipedia.org/wiki/%E0%A4%9F%E0%A5%87%E0%A4%AE%E0%A5%8D%E0%A4%AA%E0%A4%B2%E0%A5%87%E0%A4%9F:Infobox_settlement/densdisp
response
<urn:uuid:6bacc0c1-cdd1-45c0-a3dd-64392e631f23>
isPartOf: CC-MAIN-2024-38
publisher: Common Crawl
description: Wide crawl of the web for September 2024
operator: Common Crawl Admin (info@commoncrawl.org)
hostname: ip-10-67-67-98
software: Apache Nutch 1.20 (modified, https://github.com/commoncrawl/nutch/)
robots: checked via crawler-commons 1.5-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)
format: WARC File Format 1.1
conformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/